Skip to content

Conversation

lovromazgon
Copy link
Contributor

Description

This PR exports the internals from paramgen so they can be reused in specgen (#TODO).

Apart from exporting it, there were a few additions (as always):

  • Support was added for external types (3c2d133), meaning that a config can now import a struct from a different package. This is needed, as we want connector configs to include the middleware config coming from the connector SDK.
  • Added support for pointers in config structs. This is needed, because some middleware configs contain pointers for when the default is not the zero value and we want to let the user overwrite that default with the actual zero value.
  • Fields tagged with json:"-" are now ignored by the generator. This enables adding additional exported utility fields, without affecting the generated specification.

Apart from these additions to paramgen, I added 2 more utility functions:

  • lang.ValOrZero a generic utility for dereferencing a pointer and getting the zero value if the pointer is nil.
  • lang.Zero a generic utility for getting the zero value for a type.

Related to ConduitIO/conduit#1523.

Quick checks:

  • I have followed the Code Guidelines.
  • There is no other pull request for the same update/change.
  • I have written unit tests.
  • I have made sure that the PR is of reasonable size and can be easily reviewed.

@lovromazgon lovromazgon requested a review from a team as a code owner November 6, 2024 20:35
Copy link
Contributor

@raulb raulb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@lovromazgon lovromazgon merged commit 9537066 into main Nov 7, 2024
3 checks passed
@lovromazgon lovromazgon deleted the lovro/export-paramgen branch November 7, 2024 17:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants