feat(core): annotate domain validation errors with property identifier - #1291
Open
AlessandroPomponio wants to merge 1 commit into
Open
feat(core): annotate domain validation errors with property identifier#1291AlessandroPomponio wants to merge 1 commit into
AlessandroPomponio wants to merge 1 commit into
Conversation
Signed-off-by: Alessandro Pomponio <alessandro.pomponio1@ibm.com>
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.
Summary
When a
Propertyhas a malformedpropertyDomain, Pydantic's validation error previously gave no indication of which property was the source of the problem. This change intercepts those errors and prepends the property'sidentifierto the message, making it immediately clear to users which property is misconfigured.High-level Changes
ado/schema/property.py: Added amodel_validatoron thePropertymodel that catchesValidationErrors raised during domain validation and re-raises them as aValueErrorthat includes the property'sidentifierin the message.tests/schema/test_property.py: Added a test verifying that a malformedpropertyDomainon aConstitutivePropertyproduces an error message containing the property's identifier.Impact
Users configuring properties with invalid domains (e.g. missing required domain fields) will now see a clear error message that names the offending property. No existing behaviour is changed for valid configurations; this is a purely additive improvement to error diagnostics.