Actual Behavior
V30ResponseUnmarshaller.unmarshal raises jsonschema.exceptions._WrappedReferencingError when the response schema defined in a different file includes $ref that refers to a schema in another file.
Expected Behavior
The unmarshaller should not raise the error for $ref.
Steps to Reproduce
openapi.yaml
openapi: "3.0.0"info:
title: sampleversion: "0.1"paths:
/books:
$ref: "./paths/books.yaml"
paths/books.yaml
get:
responses:
"200":
description: OKcontent:
application/json:
schema:
type: arrayitems:
$ref: "../schemas/book.yaml#/Book"
schemas/book.yaml
Book:
type: objectproperties:
id:
$ref: "#/BookId"title:
type: stringBookId:
type: string
validate.py
importjsonimportosimportopenapi_coreimportopenapi_core.testingfromopenapi_coreimportV30ResponseUnmarshallerSPEC_PATH=os.path.join(os.path.dirname(__file__), "openapi.yaml")
content, base_uri=content_factory.from_file(SPEC_PATH)
returnV30ResponseUnmarshaller(
spec=SchemaPath.from_dict(content, base_uri=base_uri)
)
request=openapi_core.testing.MockRequest(
host_url="", method="GET", path="/books"
)
response=openapi_core.testing.MockResponse(
data=json.dumps([{"id": "BOOK:01", "title": "Test Book"}]).encode()
)
unmarshaller.unmarshal(request, response) # raises errorOpenAPI Core Version
0.19.3
OpenAPI Core Integration
NA
Affected Area(s)
unmarshalling, schema
References
Almost a full copy of the previous issue.
#852
Anything else we need to know?
Similar fix to be done here:
| defevolve(self, schema: SchemaPath) ->"SchemaValidator": |
| cls=self.__class__ |
| |
| withschema.open() asschema_dict: |
| returncls(schema, self.validator.evolve(schema=schema_dict)) |
Would you like to implement a fix?
Yes
Actual Behavior
V30ResponseUnmarshaller.unmarshal raises jsonschema.exceptions._WrappedReferencingError when the response schema defined in a different file includes $ref that refers to a schema in another file.
Expected Behavior
The unmarshaller should not raise the error for $ref.
Steps to Reproduce
openapi.yaml
paths/books.yaml
schemas/book.yaml
validate.py
OpenAPI Core Version
0.19.3
OpenAPI Core Integration
NA
Affected Area(s)
unmarshalling, schema
References
Almost a full copy of the previous issue.
#852
Anything else we need to know?
Similar fix to be done here:
openapi-core/openapi_core/validation/schemas/validators.py
Lines 38 to 42 in 2e98965
Would you like to implement a fix?
Yes