Skip to content

feat: more informative error message#719

Merged
woodruffw merged 14 commits intomainfrom
ww/reandreev/main
Apr 30, 2025
Merged

feat: more informative error message#719
woodruffw merged 14 commits intomainfrom
ww/reandreev/main

Conversation

@woodruffw
Copy link
Copy Markdown
Member

Recreation of #662.

Supersedes #662.
Closes #646.

@woodruffw woodruffw self-assigned this Apr 30, 2025
Signed-off-by: William Woodruff <[email protected]>
Signed-off-by: William Woodruff <[email protected]>
@woodruffw woodruffw marked this pull request as ready for review April 30, 2025 04:37
@woodruffw woodruffw merged commit d5c3bcd into main Apr 30, 2025
8 checks passed
@woodruffw woodruffw deleted the ww/reandreev/main branch April 30, 2025 04:38
Comment thread src/utils.rs
Comment on lines +55 to +60
// HACK: error descriptions are sometimes a long rats' nest
// of JSON objects. We should render this in a palatable way
// but doing so is nontrivial, so we just skip them for now.
// NOTE: Experimentally, this seems to mostly happen when
// the error for an unmatched "oneOf", so these errors are
// typically less useful anyways.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd be happy to provide a more structured output from the jsonschema side to improve the situation here - better handling for oneOf was previously requested, but I didn't work on it yet.

Feel free to tag me on anything related to jsonschema crate changes, I am keen to make it more convenient to use :)

The current idea is to store the inner oneOf errors and make them accessible through the root oneOf error (at least users can have at least some level of introspection)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Stranger6667, a more structured output here would be amazing! I can file an issue upstream in a bit demonstrating the current behavior (instead of just a HACK comment 😅).

(And thank you for making jsonschema!)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! A concrete example would be very helpful as a part of an upstream issue :)

And thank you for your kind words

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Opened Stranger6667/jsonschema#739, let me know if there's any other details that would be helpful!

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.

Feature: informative error message

3 participants