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

Improve JSONSchemaType errors #1525

Merged
merged 1 commit into from
Apr 1, 2021

Conversation

erikbrinkman
Copy link
Collaborator

What issue does this pull request resolve?

#1521 highlighted that the new additions for union types made errors less clear.

What changes did you make?

Rearranged the largest union in the type to put the non union types last. Typescript seems to default to the last element when reporting errors. I think it will report all if you turn on verbose reporting, but most people probably aren't.

Is there anything that requires more attention while reviewing?

It's just a simple reordering. Not sure if git's diff picks up on that, but it should be pretty trivial.

typescript seems to report errors with the last member of a valid union
first, so this rearranges the type so the simple union types come first,
and the type that represents the meaty types comes last. This should
help make errors like the one in ajv-validator#1521 more clear.
@epoberezkin
Copy link
Member

Thank you! what happened with the build I wonder...

@epoberezkin epoberezkin merged commit 9473b75 into ajv-validator:master Apr 1, 2021
@erikbrinkman erikbrinkman deleted the json-schema-errors branch April 1, 2021 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants