feat: Show python types in ValidationError messages#3735
Merged
dangotbanned merged 3 commits intomainfrom Jan 2, 2025
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #2914
Description
This PR adapts the logic from the code generation, for use in
SchemaValidationErrormessages.sort_type_reprsaltair/tools/schemapi/utils.py
Lines 1106 to 1146 in 48e976e
SchemaInfo.to_type_repraltair/tools/schemapi/utils.py
Lines 449 to 543 in 48e976e
Examples
Future Work
This could be extended further by expanding on what is allowed within a
Sequence.I'm stopping short of that in this PR - as it is quite a bit more complex and would require restructuring the format of the entire message.
For now, we've just got basic 1:1 replacements &
"object": "Mapping[str, Any]"where the key type is enforced by https://json-schema.org/understanding-json-schema/reference/objectaltair/altair/utils/schemapi.py
Lines 601 to 608 in 4836399