-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add json schema generation tool #59
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Roaa Sakr <[email protected]>
Signed-off-by: Roaa Sakr <[email protected]>
Signed-off-by: Roaa Sakr <[email protected]>
Signed-off-by: Roaa Sakr <[email protected]>
Signed-off-by: Roaa Sakr <[email protected]>
@@ -66,6 +67,13 @@ func (s *PartitionSize) UnmarshalJSON(data []byte) error { | |||
return parseAndSetPartitionSize(stringValue, s) | |||
} | |||
|
|||
func (PartitionSize) JSONSchema() *jsonschema.Schema { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll probably want a JSONSchema
function on each type that has a UnmarshalYAML
function.
|
||
BINARY_NAME := bin/imagecustomizerschemacli | ||
GO_FILES := $(wildcard *.go) | ||
SCHEMA_FILE := schema.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this schema.json
be checked-in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I'm planning to but will do that in a separate change. The other change will include adding a github workflow to ensure this file is kept up to date with any change/PR.
Add a cli that generates image customizer API json schema.
The generated schema file can be leveraged by other tools for API dependency and config validation.
Here's an example using it in VSCode for syntax validation:
Checklist