-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
If a path has common parameters declared outside of the operations, those parameters are not included in the generated operation requests / operation handler types.
paths:
/foo/{id}:
parameters:
- in: path
name: id
schema:
type: string
required: true
- in: query
name: x
schema:
type: string
required: false
get:
operationId: getFoo
...
put:
operationId: putFoo
parameters:
- in: query
name: y
schema:
type: number
required: false
...
This results in these handlers, as expected:
export interface OperationHandlers<T> extends Record<string, OperationHandler<T, any>> {
getFoo: OperationHandler<T, operations['getFoo']>;
putFoo: OperationHandler<T, operations['putFoo']>;
}
However, when implementing the operations getFoo and putFoo, the req.params and req.query types will not include the id and x parameters that were declared on the path level. Instead, putFoo will only have a req.query type of {y?: number}.
Expected:
getFoo should have req.params typed as {id: string} and req.query typed as {x?: string}
putFoo should have req.params typed as {id: string} and req.query typed as {x?: string, y?: number}
Metadata
Metadata
Assignees
Labels
No labels