Semantic Error raised only if paths are defined in a certain order
Q&A (please complete the following information)
- OS: macOS
- Browser: safari, Firefox
- Version: Safari 14, Firefox 82
- Method of installation: docker and editor.swagger.io
- Swagger-Editor version: v3.14.4
- Swagger/OpenAPI version: OpenAPI 3.0.1
Content & configuration
Example Swagger/OpenAPI definition:
openapi: 3.0.1
info:
title: pet API
version: 1.0.0
paths:
'/v0/pets/{pet_id}':
get:
operationId: getPipeline
parameters:
- name: pet_id
in: path
required: true
schema:
type: string
responses:
'200':
description: Ok
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/response_wrapper'
- type: object
properties:
data:
$ref: '#/components/schemas/pet'
'/v0/pets/{pet_id}/executions':
get:
operationId: getHistoricalExecutions
parameters:
- $ref: '#/paths/~1v0~1pets~1%7Bpet_id%7D/get/parameters/0'
- name: num_executions
in: query
required: true
schema:
minimum: 1
type: integer
default: 1
responses:
'200':
description: Ok
content:
application/json:
schema:
allOf:
- $ref: '#/components/schemas/response_wrapper'
- type: object
properties:
data:
type: array
items:
$ref: '#/components/schemas/checkup'
'/v0/kennels/{id}':
get:
parameters:
- name: id
in: path
required: true
schema:
type: string
responses:
'200':
description: ''
components:
schemas:
pet:
type: object
properties:
schedule:
type: string
response_wrapper:
type: object
properties:
data:
$ref: '#/components/schemas/pet'
checkup:
type: object
properties:
execution_id:
type: string
Describe the bug you're encountering
When configured as above, I see this error:

To reproduce...
Steps to reproduce the behavior:
- Go to 'https://editor.swagger.io/' OR run docker container
- Paste API Definition from above
- See error
- Move route "'/v0/kennels/{id}'" either as the 1st or 2nd route from the tops
- See error dissappear
Expected behavior
I would expect to not see this error regardless of the route ordering
Screenshots
-
/v0/kennels/{id}' as last defined route shows error

-
/v0/kennels/{id}' as first route shows no error

Additional context or thoughts
This seems to happen with this specific combination of parameters and references -- This is the minimal version I could make of a much larger API that still displays this same behavior. The API definition is generated, which is why the references are messy (parameters pointing to parameters of other routes rather than context/parameter definitions).
Same issue
In my case, this was fixed after I define parameters at the parameters section:
components:
parameters:
- name: id
in: path
required: true
or, when I compile yaml with swagger cli with the dereference option, this also helps
swagger-cli bundle src/openapi.yaml --dereference
Agreed regarding dereferencing -- that seems to get it running again, though it does lead to a pretty messy file.
Any updates on this?