-
Notifications
You must be signed in to change notification settings - Fork 10
add json schema for model config #48
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: caozhuozi <[email protected]>
Would you add a schema for all the spec? It makes sense to add them in one shot, better having a script to auto-generate the go files. |
HI, @bergwolf Thank you for reviewing the PR!
Are you referring to the manifest specification? Initially, I thought yes, but then I wondered given that the manifest spec itself follows the OCI manifest format, would it be redundant? Hope I understand the question correctly. 🙇 |
@caozhuozi I'm mostly considering auto-generating .go files from the json schema. Can we do it w/ the current schema? |
I'm not sure if this behavior is consistent with the current OCI image-spec. I'll look into it and confirm in the following comment. Im also thinking generating a JSON schema from Go structs might also be a reasonable alternative? What do you think? |
I've checked out the image-spec JSON schema files, and it looks like they were added manually. There doesn't seem to be any auto generation in both directions. For example, see the commit history of config-schema.json: https://github.com/opencontainers/image-spec/commits/main/schema/config-schema.json The only automation thing I've found related to the JSON schema files is a validation process. If you look at the Makefile and the spec_test.go, you can see it validates some example JSONs against the schema using the github.com/santhosh-tekuri/jsonschema/v5 package (see https://github.com/opencontainers/image-spec/blob/main/schema/validator.go#L27). Of course, I'm not saying generating code wouldn't be a good idea. ;-) |
@caozhuozi I see. Thanks for the details! Then, could you add the validation tests so that we make sure the |
@bergwolf |
fix: #46