Skip to content

Add schema for yaml configuration file #4079

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

Closed
wants to merge 1 commit into from

Conversation

stsewd
Copy link
Member

@stsewd stsewd commented May 10, 2018

This refs to #4058

I wasn't sure of where put this. I justs added the validation scheme based on the current yaml https://docs.readthedocs.io/en/latest/yaml-config.html.

The schema is from http://json-schema.org, there is a js tool to validate the scheme against a yaml file https://github.com/json-schema-everywhere/pajv.

Some additional steps here are:

@stsewd
Copy link
Member Author

stsewd commented May 10, 2018

By the way, I think that maybe we could use this to validate the current version too, so we don't have separate code for v1 and v2.

Also, there are other features to add dependencies between objects, but I haven't added here yet, I wanted to hear your thoughts before continuing :)


"version": {
"description": "The version of the spec to use",
"type": "string",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

String just in case we have some experimental versions like "latest"

"type": "array",
"items": {
"type": "string",
"enum": ["htmlzip", "pdf", "epub", "singlehtmllocalmedia"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added the singlehtmllocalmedia option regarding to #3220 (a little long by the way)

},

"requirements_file": {
"description": "The path to the requirements file from the root of the project",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't find any format to path, so we need to validate this on our side (we need to validate that the path exists anyway)

"description": "The Python versions",
"type": "string",
"enum": ["2", "2.7", "3", "3.3", "3.4", "3.5", "3.6"],
"default": "2.7"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Soon this would be 3.6 :)

"enum": ["2", "2.7", "3", "3.3", "3.4", "3.5", "3.6"],
"default": "2.7"
},
"setup_py_install": {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can rename this to setup_install?

@stsewd
Copy link
Member Author

stsewd commented May 10, 2018

And here is the spec of the scheme I'm using http://json-schema.org/specification-links.html#draft-7

@humitos
Copy link
Member

humitos commented May 10, 2018

@stsewd why did you decide using json schema over yamale?

@stsewd
Copy link
Member Author

stsewd commented May 10, 2018

Is more standard and reach

@agjohnson
Copy link
Contributor

agjohnson commented May 11, 2018

Just noted this on the issue, i think we should stick with python here as well. There is a possibility to make the schema tests into a unit test if we use a python library.

Also, instead of hiding this in our doc path, let's bring this into something more top level, or add this as a test fixture

@agjohnson agjohnson added this to the 2.5 milestone May 11, 2018
@agjohnson agjohnson added the PR: work in progress Pull request is not ready for full review label May 11, 2018
@stsewd
Copy link
Member Author

stsewd commented May 11, 2018

I'm doing this on other PR #4084

@stsewd stsewd closed this May 11, 2018
@stsewd stsewd deleted the yaml-schema branch May 14, 2018 17:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: work in progress Pull request is not ready for full review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants