Skip to content

Include parameter name in JSON Schema error path on unmarshalling #246

Description

@playpauseandstop

Hi,

I've run into the problem, when I'm not able to show which invalid parameter raised an InvalidSchemaValue.

As InvalidSchemaValue contains a list of schema_errors (List[JsonSchemaValidationError]) I expect to have relative_path / absoulte_path filled for its items. But in reality all items have empty path / relative_path attributes (and absolute_path property).

I've managed to fix this by manually add parameter name as JSON Schem error path as,

try:
returnunmarshaller(value)
exceptInvalidSchemaValueaserr:
# Modify invalid schema validation errors to include parameter nameifisinstance(param_or_media_type, Parameter):
param_name=param_or_media_type.nameforschema_errorinerr.schema_errors:
schema_error.path=schema_error.relative_path=deque(
[param_name]
)
raiseerr

instead of plain,

returnunmarshaller(value)

But would like to have path filled by openapi_core instead.


More details in playpauseandstop/rororo#53

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/castingIndicates an issue on casting area.area/unmarshallingIndicates an issue on unmarshalling area.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions