Closed
Description
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
file
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 aboveopenapi.yaml
file onto https://editor-next.swagger.io/ to see it working as expected
Metadata
Metadata
Assignees
Labels
No labels