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

Distinguish json schema lint error from validation error #680

Closed
Zane-XY opened this issue Mar 24, 2023 · 1 comment
Closed

Distinguish json schema lint error from validation error #680

Zane-XY opened this issue Mar 24, 2023 · 1 comment

Comments

@Zane-XY
Copy link

Zane-XY commented Mar 24, 2023

Lint errors and validation errors are two kind of errors. Lint error means the schema syntax is invalid. But currently, it seems both kinds of errors are aggregated in the same Set<com.networknt.schema.ValidationMessage>, you can not distinguish them from each other.

for example, given an invalid json schema definition:

{
  "type": "Object", <-- notice O is uppercase here
  "$schema": "https://json-schema.org/draft/2019-09/schema",
   ...

There should be a way to detect this error, before validate against the input.

image

@stevehu
Copy link
Contributor

stevehu commented Mar 26, 2023

We expect the user to provide a valid schema as the input; if you are unsure, you can use the meta schema to validate your schema before using it. If the schema is not valid, we cannot currently separate the error from the JSON object error. I am open to suggestion on how to handle it. Thanks.

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

No branches or pull requests

2 participants