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

There is no way to disable strict mode when using cli #220

Open
ssbarnea opened this issue Sep 14, 2022 · 4 comments
Open

There is no way to disable strict mode when using cli #220

ssbarnea opened this issue Sep 14, 2022 · 4 comments

Comments

@ssbarnea
Copy link

ssbarnea commented Sep 14, 2022

Apparently there is no way to disable strict mode when using ajv and that would not be such a big deal unless it would have allowed me to make use of markdownDescription property, something that is very popular among schema authors as it allows us to include markdown in descriptions and have nice popup in IDEs, like vscode.

$ ajv compile -s f/ansible-meta.json 
error: strict mode: unknown keyword: "markdownDescription"

While I was able to fix the other problems, that one is impossible to address. This also make it impossible to use ajv-cli as part of CI/CD pipelines for validating the schema, as it would always be "invalid" due to this.

@handrews
Copy link

You can pass --strict=false

@gregsdennis
Copy link

I wonder if this warrants bringing up an issue in VSCode as well to get them to just use description. Have you found any docs on markdownDescription? Where did you see to use this property?

@ssbarnea
Copy link
Author

ssbarnea commented Sep 15, 2022

It is documented at https://code.visualstudio.com/api/references/contribution-points#Configuration-property-schema and few other places. They did not make it secret.

Regarding how wild is its use, probably https://sourcegraph.com/search?q=context:global+markdownDescription+lang:json&patternType=standard can give you some hints. For example all Ansible related schemas make use of it because YAML extension does also recognize and use it, having markdown tooltips being essential as rich explanations are often needed.

Based on some discussions I had over time with the main brain behind JSON Schema Specification (@Relequestual) , I learnt that:

  • their markdownDescription extension is valid use of Schema, but it might impose a burden for schema writers, as it would force them to double the descriptions if they want to keep compatibility with other schema consumers
  • adding a top level property such "hasMarkdown: true" and reusing description could prove better as markdown is still valid plain text, so users can still make use of it.

I did raise a proposal on json-schema-org/json-schema-vocabularies#42 few months back but I did not get enough time to advertise it so it kinda got lost. Maybe we can persuade few more to support it and document it, even if it might now be part of official spec for some time. Still, if the desire is, there is nothing preventing others from start using it, as being future proof.

@gregsdennis
Copy link

gregsdennis commented Sep 15, 2022

Based on some discussions I had over time with the main brain behind JSON Schema Specification

😆 So far everyone who has responded in this thread are part of the main brain behind JSON Schema. We're all part of the core team.

I do remember seeing your proposal. I think that it might be better as a larger vocab that incorporates other keywords. However, even so, that specific keyword would be an annotation only, and 2020-12 already directs implementations to collect unknown keywords as annotations, so it's not really adding anything functionally that implementations don't already do.

I still think the primary action here is for VSCode to use description instead of their own property.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants