-
Notifications
You must be signed in to change notification settings - Fork 168
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
Define JSON Schema for construct.yml
#943
Conversation
construct.yml
I don't think alphabetic order would be good. Some values should be grouped together. That said, that's not currently enforced. I couldn't find any tools to do this automatically, so I'd rather not introduce a requirement we can't enforce easily in the future. For now I'll leave it as is. |
Thank you @marcoesters for the thorough review! I think we are getting closer. There are some open questions:
|
This doesn't render very well with the viewer in this PR. It just becomes
I think that's fine. I personally find it easier to find things when they keywords are alphabetized since we don't have any groupings by installer type.
Where is the |
Found a way to render this better. |
Nowhere besides the repo for now. I need to finish that part where we publish it to schemas.conda.org. |
On the current
For primarily machine-readable files, it doesn't matter as long as it's consistent over time, especially for new things, again to maintain diffability. If a change is small, it should generate a small diff. Over on To group things together, there are some choices:
|
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.
Thank you! If the loss of information in the docs becomes an issue, we can always revisit regenerating the docs from the schema.
Description
This PR converts our venerable
construct.py
"schema" to a proper JSON Schema. The Schema is built with Pydantic at "commit time" as we do with docs regeneration. At runtime, only the lightweightjsonschema
package is used for validation.With this change we have:
construct.yml
to the schema in the repoHowever we have lost the ability to report type information in the docs (the autogenerated annotations are too wordy and noisy). I'm not too worried about this because the information was sometimes inaccurate anyway. Instead users are encouraged to use the schema directly, either in their IDE, or exploring it interactively in apps like https://json-schema.app/view/%23?url=https%3A%2F%2Fraw.githubusercontent.com%2Fjaimergp%2Fconstructor%2Frefs%2Fheads%2Fpydantic-schema%2Fconstructor%2Fdata%2Fconstruct.schema.json.
Checklist - did you ...
news
directory (using the template) for the next release's release notes?Additional context:
@bollwyvl mentioned this in a conda-forge Zulip thread and I couldn't resist to attempt a crude conversion. The first commit already gives you inline descriptions and some type validation.
Plenty of work ahead for the very diverse types and actual default values, plus integration with
constructor
itself.For fun and laughs, this is the crude script that I used to convert our venerable
KEYS
"schema" to a Pydantic model: