Skip to content
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

Merged
merged 11 commits into from
Jan 31, 2018

Conversation

davidor
Copy link
Contributor

@davidor davidor commented Jan 25, 2018

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

@davidor davidor requested a review from mikz January 25, 2018 14:19
@davidor davidor force-pushed the json-schemas-descriptions branch from a785665 to e94a0e3 Compare January 25, 2018 14:20
@@ -1,9 +1,28 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"title": "Caching policy configuration",
"description":
Copy link
Contributor Author

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.

Copy link
Contributor

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.

@mikz
Copy link
Contributor

mikz commented Jan 25, 2018

@davidor we should define where to have those descriptions. I'm not sure the schema is the right one, because we also need some manifest that defines a version etc. as started in #564

@davidor davidor changed the title Add descriptions in the policy json schemas [WIP] Add descriptions in the policy json schemas Jan 25, 2018
@davidor davidor force-pushed the json-schemas-descriptions branch from f597af5 to d42e020 Compare January 25, 2018 17:26
@davidor davidor changed the title [WIP] Add descriptions in the policy json schemas [WIP] Add policy manifest and make existing schemas conform with it Jan 25, 2018
@davidor davidor force-pushed the json-schemas-descriptions branch from d42e020 to 1ac9c83 Compare January 25, 2018 17:38
@davidor davidor force-pushed the json-schemas-descriptions branch 2 times, most recently from a4081c3 to 225faf8 Compare January 26, 2018 14:44
@davidor davidor changed the title [WIP] Add policy manifest and make existing schemas conform with it Add policy manifest and make existing schemas conform with it Jan 26, 2018
@davidor davidor force-pushed the json-schemas-descriptions branch 2 times, most recently from 1a165be to e7d780d Compare January 26, 2018 14:58
"mode. It makes sense only in very specific use cases.\n",
"- None: disables caching."],
"version": "0.1",
"configuration": {
Copy link
Contributor

@mikz mikz Jan 26, 2018

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.

Copy link
Member

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.

Copy link
Contributor Author

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 configurationcomplies with http://json-schema.org/draft-07/schema#".
Adding $schema in the configuration object does not solve the issue.

Copy link
Contributor

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.

Copy link
Contributor Author

@davidor davidor Jan 29, 2018

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.

@davidor davidor force-pushed the json-schemas-descriptions branch from e7d780d to 156f20f Compare January 26, 2018 19:34
@davidor davidor force-pushed the json-schemas-descriptions branch from 156f20f to c3f48d6 Compare January 29, 2018 10:57
@davidor davidor mentioned this pull request Jan 30, 2018
Copy link
Contributor

@mikz mikz left a 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.

@davidor davidor merged commit 6abee52 into master Jan 31, 2018
@davidor davidor deleted the json-schemas-descriptions branch January 31, 2018 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants