rancher / hull

Keep your Helm charts afloat with comprehensive testing
Apache License 2.0
4 stars 5 forks source link

Generating a JSON schema should not be done automatically #1

Closed aiyengar2 closed 1 year ago

aiyengar2 commented 1 year ago

Currently the behavior of hull is to automatically handle overriding the JSON schema on seeing a test error; however, this behavior can result in pitfalls as users do not expect running a test to modify the content of what is being tested.

Instead, processing an automatic override should be guarded by an environment variable that needs to be set on a go test run (OVERWRITE_SCHEMA=1) to automatically perform this action.

aiyengar2 commented 1 year ago

Instead of resolving this as a feature flag created via environment variable, I think it makes more sense to create a Go binary version of Hull (in a cmd directory).

This binary can offer features around file management in a repository using Hull with Helm charts, such as:

All mutating operations can then be put in the binary (to be explicitly called by a developer) instead of being done during a test execution.

aiyengar2 commented 1 year ago

Instead of resolving this as a Go Binary, I'm switching the approach to providing library functions for users to be able to run go generate to create and manage the values.schema.json file. Example will be provided on how to set up code generation to do that.

This otherwise offers the same possibilities as listed above in the binary approach but in a more user-configurable way.

aiyengar2 commented 1 year ago

Now supported via go generate, docs are updated too