-
Notifications
You must be signed in to change notification settings - Fork 308
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 JSON schema for .ort.yml configuration #4639
Add JSON schema for .ort.yml configuration #4639
Conversation
7d52f91
to
87a0cb4
Compare
87a0cb4
to
2202ffe
Compare
@@ -0,0 +1,433 @@ | |||
{ |
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.
Is there any benefit in putting this file in the source tree? Otherwise I would suggest to put it somewhere, maybe the "integrations" folder, and test it similar to how the examples are tested.
Would you mind listing the tool you looked at? For example, did you try https://github.com/FasterXML/jackson-module-jsonSchema? Edit: As a note to myself, if we'd be using kotlinx.serialization, we could probably use https://github.com/Ricky12Awesome/json-schema-serialization. |
I tried https://github.com/mbknor/mbknor-jackson-jsonSchema. I also tried your linked https://github.com/FasterXML/jackson-module-jsonSchema.
And the |
2202ffe
to
e4796bc
Compare
@@ -60,6 +60,10 @@ Files: clients/github-graphql/src/main/assets/* | |||
Copyright: 2021 Bosch.IO GmbH <osm@bosch.com> | |||
License: Apache-2.0 | |||
|
|||
Files: integrations/schemas/* |
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.
Commit message nits:
- I think it's fine / better to drop the "JSON-schema" prefix; we usually use these prefixes to denote which existing code is touched, but here the code does not exist yet. And the part after ":" also talks about "JSON schema".
-
- [3] links to RubyMine docs. Probably https://www.jetbrains.com/help/idea/json.html#ws_json_schema_add_custom is better.
A JSON schema [1] is a description of a JSON document, which can also be used for YAML files. This schema can be used to enable auto-completion in multiple editors for the .ort.yml file [2]. E.g. IntelliJ IDEA has build-in support for it [3]. [1]: https://json-schema.org [2]: https://www.schemastore.org/json [3]: https://www.jetbrains.com/help/idea/json.html#ws_json_schema_add_custom Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
Signed-off-by: Marcel Bochtler <marcel.bochtler@bosch.io>
e4796bc
to
6a14ac6
Compare
A JSON schema 1 is a description of a JSON document, which can also be
used for YAML files. This schema can be used to enable auto-completion
in multiple editors for the .ort.yml file 2. E.g. IntelliJ IDEA has build-in support
for it 3:
As a next step, the URL to this schema can be contributed to https://github.com/schemastore/schemastore/ and many editors will then have autocompletion for .ort.yml out of the box.
It would be nice to autogenerate this file, however I didn't find a convenient way to do this.
Adding the test coverage to avoid regressions in the schema should be good enough for now.
Missing as of now is the documentation from the model classes. It would be nice to also get this documentation during auto completion.
I opted to use the JSON format instead of a YAML format, to ensure better compatibility. I was e.g. not able to use a YAML schema with VS Code.