-
Notifications
You must be signed in to change notification settings - Fork 56
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
generic: add schema for config.yml #1353
Conversation
Hey @xpillons , here is a draft for validating the config.yml via a JSON schema Couple of points to decide/fix
cc @matt-chan |
3187a88
to
dc65e3e
Compare
@ltalirz this is a great start.
I would add an option in the |
dc65e3e
to
2e3bdf4
Compare
Add JSON schema for validating config.yml The confing.yml is automatically validated against the schema when running `build.sh`. A "mode key" is added to the `config.tpl.yml`, which points to the schema and provides automatic validation in VSCode with the "YAML" extension by RedHat.
2e3bdf4
to
c12ddb9
Compare
Hi @xpillons, thanks for the quick review; I've addressed your comments, the remaining question would be whether to remove any mention of |
@ltalirz please build the schema based strictly on |
e6f579d
to
80cfad4
Compare
@ltalirz what would be the process to update the schema ? is there a tool to do this ? if so can instructions be added ? |
For the first draft I programmatically inferred the schema from the existing yml file and then manually added descriptions, constraints, etc. I believe for minor changes to the config.tpl.yml it would be easiest to just edit the schema manually, it's quite straightforward and VS Code already knows all the allowed fields in JSON Schema, which makes it even easier. One aspect you may want to think about is whether the in-line documentation can eventually be removed from the Having it in the schema seems important to be able to provide good error messages; this should also make it straightforward to reuse in a GUI on the Azure Marketplace. At the moment this information is somewhat duplicated (but maybe ok for the time being).
I guess this would call for a new section of the az-hop documentation aimed at developers rather than admins? |
P.S. The schema can also be used to define default values transparently. I've not yet started doing that. |
ok, got it. In fact not all customers are using VSCode, hence docs in the template file directly. And yes we should have a developer section in the doc. |
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 approve this first release, we can work on adding more constraints in the future
Add JSON schema for validating config.yml
The config.yml is automatically validated against the schema when running
build.sh
. A "modeline" is added to theconfig.tpl.yml
, which points to the schema and provides automatic validation in VSCode with the "YAML" extension by RedHat.