Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using a $ref for path items results in a validation error even though doing so is valid as per the OpenAPI 3.1 spec (here)
$ref
openapi.yaml file
openapi.yaml
openapi: 3.1.0 info: title: Example API version: 1.0.0 paths: /: $ref: "#/components/pathItems/rootPath" components: pathItems: rootPath: get: responses: 200: description: Example Response
Running
openapi-spec-validator openapi.yaml
Results in
# Validation Error Unevaluated properties are not allowed ('$ref' was unexpected) Failed validating 'unevaluatedProperties' in schema['properties']['paths']['patternProperties']['^/']: {'$ref': '#/$defs/specification-extensions', 'patternProperties': {'^(get|put|post|delete|options|head|patch|trace)$': {'$ref': '#/$defs/operation'}}, 'properties': {'description': {'type': 'string'}, 'parameters': {'items': {'$ref': '#/$defs/parameter-or-reference'}, 'type': 'array'}, 'servers': {'items': {'$ref': '#/$defs/server'}, 'type': 'array'}, 'summary': {'type': 'string'}}, 'type': 'object', 'unevaluatedProperties': False} On instance['paths']['/']: {'$ref': '#/components/pathItems/rootPath'}
Note You can paste the above openapi.yaml file onto https://editor-next.swagger.io/ to see it working as expected
The text was updated successfully, but these errors were encountered:
It looks like changing #/$defs/path-item to #/$defs/path-item-or-reference in [$defs][paths] seems to work as expected
#/$defs/path-item
#/$defs/path-item-or-reference
[$defs][paths]
openapi-spec-validator/openapi_spec_validator/resources/schemas/v3.1/schema.json
Lines 277 to 286 in 999ed1c
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
Summary
Using a
$ref
for path items results in a validation error even though doing so is valid as per the OpenAPI 3.1 spec (here)Minimal Example
openapi.yaml
fileRunning
Results in
The text was updated successfully, but these errors were encountered: