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

Expose failing JToken in ValidationError #1692

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ouvreboite
Copy link

@ouvreboite ouvreboite commented Apr 12, 2024

Hi there. A very small PR that would greatly improve how I can post-process validation errors 🙂

Exposing the JToken that failed the error will allow NJsonSchema users to access various information, including the actual content of the failed token.

For example, when you have a "StringExpected" error, you can quickly access ValidationError.Token to see what is the actual value that is not a string. Especially handy for investigating non-nullable field that received a null value.

Exposing the JToken that failed the error will allow NJsonSchema to better leverage validation errors by accessing the value that failed the schema.
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.

None yet

1 participant