Summary
Validation error messages currently use JSON property names (getJsonName()) for identifying missing or invalid fields, even when parsing XML content. This can be confusing for users working with XML-only scenarios.
Current Behavior
When parsing XML and a required field is missing, the error message references the JSON property name:
Missing required property: some-json-name
Proposed Behavior
Error messages should adapt based on the parsing context:
- JSON/YAML parsing: Use JSON property name
- XML parsing: Use XML element/attribute name
Example for XML:
Missing required element: some-xml-element
Affected Code
AbstractProblemHandler.java - isRequiredAndMissingDefault() and related methods use getJsonName()
DefaultXmlProblemHandler.java - Should use XML names
DefaultJsonProblemHandler.java - Should continue using JSON names
Implementation Notes
- The
IBoundProperty interface provides both getJsonName() and getXmlQName() methods
- Format context would need to be passed through the problem handler hierarchy
- Consider whether to use qualified names or local names for XML
Related
This was identified during PR #593 code review as a nice-to-have improvement.
Summary
Validation error messages currently use JSON property names (
getJsonName()) for identifying missing or invalid fields, even when parsing XML content. This can be confusing for users working with XML-only scenarios.Current Behavior
When parsing XML and a required field is missing, the error message references the JSON property name:
Proposed Behavior
Error messages should adapt based on the parsing context:
Example for XML:
Affected Code
AbstractProblemHandler.java-isRequiredAndMissingDefault()and related methods usegetJsonName()DefaultXmlProblemHandler.java- Should use XML namesDefaultJsonProblemHandler.java- Should continue using JSON namesImplementation Notes
IBoundPropertyinterface provides bothgetJsonName()andgetXmlQName()methodsRelated
This was identified during PR #593 code review as a nice-to-have improvement.