-
Notifications
You must be signed in to change notification settings - Fork 16
Closed
Description
Package version
0.12
Describe the bug
I have a spec whose relevant section looks like this:
"/api/1/metastore/schemas/dataset/items/{identifier}": {
"get": {
"operationId": "dataset-get-item",
"summary": "Get a single dataset.",
"tags": [
"Metastore: dataset"
],
"parameters": [
{
"$ref": "#/components/parameters/datasetUuid"
},
{
"$ref": "#/components/parameters/showReferenceIds"
}
],
"responses": {
"200": {
"description": "Full dataset item.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/dataset"
}
}
}
},
"404": {
"$ref": "#/components/responses/404IdNotFound"
}
}
},When I upgrade to v0.12, the SchemaValidator breaks with:
TypeError: League\OpenAPIValidation\Schema\SchemaValidator::validate(): Argument #2 ($schema) must be of type cebe\openapi\spec\Schema, cebe\openapi\spec\Reference given, called in /var/www/html/vendor/league/openapi-psr7-validator/src/PSR7/Validators/BodyValidator/UnipartValidator.php on line 58
I believe this is because the schema is a reference, and in #52 the ValidatorBuilder now passes a specObject from Reader instead of.. I'm not sure what, but whatever it was doing before. Now validate() fails because it's getting a Reference, which previously must have somehow been resolving to a Schema.
To Reproduce
Sorry I'm not sure the best way to tell you to how to reproduce it.
Expected behaviour
Specs that provide response schemas via references continue to work for validation.
Metadata
Metadata
Assignees
Labels
No labels