so I have been facing the same issue. references to parameters didn’t work. it was one of the query params that was causing this issue and as mentioned above, it is not ideal to add them to every path. and we were using openapi-generator-cli.jar
to generate the typescript sdk based on the openapi.yml file.
In our case, we copied the actual spec in one for the request, and for all other requests, it was using $ref, it worked!
example:
/users:
get:
tags:
- Users
operationId: listUsers
parameters:
- name: page
in: query
description: The current page (starts at 0)
required: false
schema:
type: integer
minimum: 0
default: 0
- name: size
in: query
description: The size of the returned page
required: false
schema:
type: integer
maximum: 100
minimum: 10
default: 20
description: |
Retrieve a list of Users that exist within the Organization.
responses:
200:
description: List of Users
content:
application/json:
schema:
$ref: "#/components/schemas/UsersResponse"
paths:
/rooms:
get:
tags:
- Rooms
operationId: listRooms
description: |
Returns a list of rooms within your hotel.
parameters:
- $ref: "#/components/parameters/PagingPageQuery"
- $ref: "#/components/parameters/PagingSizeQuery"
parameters:
...
PagingPageQuery:
name: page
in: query
description: The current page (starts at 0)
required: false
schema:
type: integer
minimum: 0
default: 0