-
Notifications
You must be signed in to change notification settings - Fork 170
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 policy manifest and make existing schemas conform with it #565
Conversation
a785665
to
e94a0e3
Compare
@@ -1,9 +1,28 @@ | |||
{ | |||
"$schema": "http://json-schema.org/draft-07/schema#", | |||
"title": "Caching policy configuration", | |||
"description": |
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.
@mikz This is the best way I found to write long descriptions. We'll need to specify in the meta-schema that the descriptions might be strings or arrays of strings.
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.
Yep, that is done in #564, but the description is not part of the schema there.
f597af5
to
d42e020
Compare
d42e020
to
1ac9c83
Compare
a4081c3
to
225faf8
Compare
1a165be
to
e7d780d
Compare
"mode. It makes sense only in very specific use cases.\n", | ||
"- None: disables caching."], | ||
"version": "0.1", | ||
"configuration": { |
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.
We might need to force $schema
key in this object, so it can be easier for other libraries to use this and know what schema it is.
@ddcesare would be good if you could let us know if we need to do this or it can be somehow figured out from the provided 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.
No need to force the $schema
key, the lib figure this out.
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.
I realized that the lint-schema
target is not working correctly. It's not checking that configuration
complies with http://json-schema.org/draft-07/schema#"
.
Adding $schema
in the configuration object does not solve the issue.
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.
I was using https://www.jsonschemavalidator.net for validation and it was ok.
But now it fails on missing $id
in the definitions/id
and definitions/schema
.
Just adding there "$id": "#/definitions/schema",
and "$id": "#/definitions/version",
makes it validate in that online editor.
What other field was not validated correctly? I tried to change the "type" column from "string" to some invalid value and that is caught.
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.
@mikz When I run make lint-schema
, the error you mention is not detected. Not sure why.
I added those ids in your commit.
Another thing I noticed is that, if I remove the "type" attr from caching_type
in the caching policy config, https://mozilla-services.github.io/react-jsonschema-form/ complains, but make lint-schema
does not. The validator that you linked doesn't show any error either.
All the rest seems to be working fine.
e7d780d
to
156f20f
Compare
Just a convention.
The reason is that this way, we can add a description for each of the options.
156f20f
to
c3f48d6
Compare
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.
Lets fix the schema requirement for the React library in some other PR.
Adds the policy manifest from @mikz in #564 and makes all the current schemas conform to it.
This PR also adds descriptions to all the configuration fields.
/cc @alanmoran