-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support providing preloaded schemas #215
Comments
Ended up going with the alternative approach of providing a custom Registry as it ended up being a simpler approach on our end. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Our goal is to be able to provide schemas that we've compiled to the validator, in order to prevent needing to read/write to a cache on the filesystem.
Context: We're distributing a command line tool that will generate k8s manifests for various projects, and would like it to work in an offline environment. Rather than distribute the schemas separately from the tool, we plan to embed them in the binary with go:embed. We could dump them to disk and then provide that path to the validator constructor, but we'd rather skip the middleman and just provide the schemas directly.
The approach we were thinking of would be to support passing in a pre-populated inMemory Cache via Opts, and setting that on the validator in New. If that doesn't sound too bad, I can put together a pull request for it.
edit: another alternative approach would be to allow providing a Registry implementation that would take precedence over the others so that we could provide our schemas if they're present in the project. That feels like it might be slightly nicer, but is a bit more complex.
The text was updated successfully, but these errors were encountered: