You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, when we transform jsonschema's ValidationErrors into CheckErrors, we don't preserve relationships between errors. For example, in the case where any of two fields must be present on an object, if both fields are missing, we output a CheckError for both. From this output alone, it is not possible to tell that filling in either of those fields would have resolved the issue.
One idea is to add a group attribute to CheckError that would make it possible to retain these relationships between errors. So in a case like the above, the output would be:
[
{
"message": "'data' is a required property",
"json_path": "$.data",
"validator": "required",
"group": "oneOf-1",
},
{
"message": "'path' is a required property",
"json_path": "$.path",
"validator": "required",
"group": "oneOf-1",
},
]
Using this output, it is possible to tell which errors belong to one group, and the name of the group implies that only one of the errors needs to be fixed.
Tasks:
Add a group attribute to CheckError. Should be optional.
Modify validation_errors_to_check_errors to populate the group field of CheckErrors. For this, an initial strategy might be looking at each ValidationError in the flattened list and checking if it is a child of a complex / summary-type error (validators for this listed in COMPLEX_VALIDATORS). ValidationErrors should have this information on them. When naming the group, keep the name unique within the list of errors (there may be multiple oneOf-type groups!) -- e.g., add a number.
Update tests.
Consider whether the information captured by group should be translated into a more user-friendly error message when the errors are displayed. For this, look at FailedCheckError and how it displays its list of CheckErrors.
The text was updated successfully, but these errors were encountered:
Currently, when we transform
jsonschema
'sValidationErrors
intoCheckErrors
, we don't preserve relationships between errors. For example, in the case where any of two fields must be present on an object, if both fields are missing, we output aCheckError
for both. From this output alone, it is not possible to tell that filling in either of those fields would have resolved the issue.One idea is to add a
group
attribute toCheckError
that would make it possible to retain these relationships between errors. So in a case like the above, the output would be:Using this output, it is possible to tell which errors belong to one group, and the name of the group implies that only one of the errors needs to be fixed.
Tasks:
group
attribute toCheckError
. Should be optional.validation_errors_to_check_errors
to populate thegroup
field ofCheckErrors
. For this, an initial strategy might be looking at eachValidationError
in the flattened list and checking if it is a child of a complex / summary-type error (validators for this listed inCOMPLEX_VALIDATORS
).ValidationError
s should have this information on them. When naming the group, keep the name unique within the list of errors (there may be multipleoneOf
-type groups!) -- e.g., add a number.group
should be translated into a more user-friendly error message when the errors are displayed. For this, look atFailedCheckError
and how it displays its list ofCheckError
s.The text was updated successfully, but these errors were encountered: