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

Nicer validation error for constants #74

Merged
merged 1 commit into from
Aug 6, 2024

Conversation

mbasaglia
Copy link
Member

@mbasaglia mbasaglia commented Aug 5, 2024

Gives a more useful error messages on enum validation errors.

@mbasaglia
Copy link
Member Author

For comparison, builtin oneOf messages:

/layers/0/shapes/0/it/0/it/0/it/0/d	error	Shape Direction must be equal to constant	[Shape Direction](https://lottie.github.io/lottie-spec/specs/constants/#shape-direction)
/layers/0/shapes/0/it/0/it/0/it/0/d	error	Shape Direction must be equal to constant	[Shape Direction](https://lottie.github.io/lottie-spec/specs/constants/#shape-direction)
/layers/0/shapes/0/it/0/it/0/it/0/d	error	Shape Direction must match exactly one schema in oneOf	[Shape Direction](https://lottie.github.io/lottie-spec/specs/constants/#shape-direction)

(3 messages for 1 error)

With custom validation:

/layers/0/shapes/0/it/0/it/0/it/0/d	error	Shape Direction 0 is not a valid enumeration value	Shape Direction

@mbasaglia mbasaglia merged commit 826e834 into lottie:main Aug 6, 2024
3 checks passed
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

Successfully merging this pull request may close these issues.

2 participants