Extract connector specifications into connector.yml
#1522
lovromazgon
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In this discussion, we're proposing a change in the connector development experience. Currently the specifications of a connector plugin are written in pure code. There are a few drawbacks to that:
To address these pain points we propose to introduce
connector.yml
, a file that will by convention live at the root of each connector repository and will contain the connector specification. There will be tooling around keeping the file up to date, using it to generate parts of the readme, using it to efficiently generate consistent documentation for connectors on conduit.io, to serve specifications in the connector (same as connectors already do) without introducing breaking changes.1. Specgen
Specgen replaces paramgen. It takes the source config and destination config structs, parses the parameters (same as paramgen) and outputs
connector.yml
instead of Go code.It's used in a
go:generate
statement, so a CI action can make sureconnector.yml
is up to date when runningmake generate
.The preferred place for this statement is in
connector.go
.//go:generate specgen -source.config SourceConfig -destination.config DestinationConfig -o connector.yml
2.
connector.yml
The generated file
connector.yml
replacesspec.go
entirely. It contains the whole specifications and is language agnostic.The only caveat is the version field, which contains the last released version. It is bumped only when releasing the next version. The very update of the version actually triggers the release (see version handling).
3. YAML specification parsing
The generated
connector.yml
is embedded in the connector binary and is used to create the specifications of the connector. TheSource
andDestination
structs don't have to implementParameters
anymore, although the functions are kept for backwards compatibility.Notice
gitRef
, which is populated during the build process with the current ref.sdk.YAMLSpecification
usesgitRef
to update the version in the specifications:gitRef
matches fieldconnector.version
fromconnector.yml
, the version is left as is (only true if the checked out ref is tagged, i.e. a release).gitRef
is populated, but does not matchconnector.version
fromconnector.yml
, the version is updated togitRef
(will be true during development).gitRef
is empty, the version gets the postfix-(devel)
.4. Version handling
We need to add some safeguards to ensure the
connector.version
field inconnector.yml
contains the correct version and matches the git tag. The idea is to use two GitHub actions to automate this:connector.yml
. If it does NOT match, it deletes the tag and fails the action, preventing the release.connector.version
inconnector.yml
manually. If needed, we can provide a script that bumps it for us.connector.yml
. If it detects one, it pushes a tag with the updated version, triggering a release.The result is a
connector.yml
that contains the correct latest released version which matches the last git tag.5. Readmegen
Readmegen uses
connector.yml
as input to populate sections in the readme. It should be run as part ofmake generate
, to allow the CI action to ensure the readme is up-to-date.6. Generate connector documentation on conduit.io
Using the introduced
connector.yml
we can then generate a documentation page for each connector on conduit.io.In the same way we currently generate the list of connectors, we can additionally fetch
connector.yml
using the GitHub API for a specific release:Then we can supply our own template that creates consistent documentation pages for all connectors.
readmegen -c connector.yml -f doc-template.md > file-connector-doc.md
Alternatively, we can fetch
README.md
directly from the connector repo, as it might provide additional information. Then again, if we do that, we can't ensure a consistent look and feel of the documentation for all connectors. Also, we rely on the connector developer to have all actions in place to ensure the readme is up-to-date. That's why it might be better to generate the doc and refer the user to the repository for additional information.7. Plugin binary commands
This is somewhat unrelated to the changes above, but it would be useful if the plugin binaries would support a few additional commands. We can implement this transparently in
sdk.Serve
and it will be applied to all connectors.I propose two commands:
connector reference
would print the full reference for this specific connector.connector specs
(orconnector specifications
) prints the YAML specifications of the connector.Beta Was this translation helpful? Give feedback.
All reactions