Extract connector specifications into connector.yml
#1522
Closed
lovromazgon
started this conversation in
Ideas
Replies: 1 comment
-
|
Done in #1523. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
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.ymlinstead of Go code.It's used in a
go:generatestatement, so a CI action can make sureconnector.ymlis 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.yml2.
connector.ymlThe generated file
connector.ymlreplacesspec.goentirely. 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.ymlis embedded in the connector binary and is used to create the specifications of the connector. TheSourceandDestinationstructs don't have to implementParametersanymore, although the functions are kept for backwards compatibility.Notice
gitRef, which is populated during the build process with the current ref.sdk.YAMLSpecificationusesgitRefto update the version in the specifications:gitRefmatches fieldconnector.versionfromconnector.yml, the version is left as is (only true if the checked out ref is tagged, i.e. a release).gitRefis populated, but does not matchconnector.versionfromconnector.yml, the version is updated togitRef(will be true during development).gitRefis empty, the version gets the postfix-(devel).4. Version handling
We need to add some safeguards to ensure the
connector.versionfield inconnector.ymlcontains 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.versioninconnector.ymlmanually. 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.ymlthat contains the correct latest released version which matches the last git tag.5. Readmegen
Readmegen uses
connector.ymlas 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.ymlwe 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.ymlusing 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.mdAlternatively, we can fetch
README.mddirectly 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.Serveand it will be applied to all connectors.I propose two commands:
connector referencewould 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