Enforce Automated Alignment from Schemas to SDK
- ADR: 0005
- Proposal Author(s): @eddie-knight, @trumant
- Status: Accepted
Context
As the Go SDK has extended, there is significant overhead to ensure consistency and compatibility with the schemas. When one changes, the other must as well. This can be automated and enforced via CI.
Action
Add a Makefile step which will automatically generate Go Types from the CUE schemas. Add a step to the CI which ensures that the generated-types.go file does not diverge from the autogenerated content. Methods, functions, and other logic will live in parallel files within the same package.
Consequences
Positive: Ensure that changes to the Go types and schemas are always done in tandem, rejecting changes made independently. Negative: All Go types will need to live in the same file, instead of being organized alongside their respective methods.
Alternatives Considered
We could make a contributor policy which requires this, and a reviewer guide to ensure it is manually enforced every time.