-
Notifications
You must be signed in to change notification settings - Fork 65
Add support for declaring path parameters on path item object instead of operation object #173
New issue
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
Conversation
12ff812 to
033703d
Compare
baywet
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for taking that, a few comments.
|
Let's keep in mind that OpenApiLinks are currently generated based on the operation parameters: We still need to be able to generate these links even when the parameters are not available at the operation level. |
src/Microsoft.OpenApi.OData.Reader/Generator/OpenApiParameterGenerator.cs
Show resolved
Hide resolved
Thanks @irvinesunday for catching this (and the suggestion on how to handle it). I have pushed a fix for to resolve it c136516 |
|
@baywet @irvinesunday @xuzhg @darrelmiller kindly have a look at the PR. |
Co-authored-by: Vincent Biret <[email protected]>
c136516 to
b171a2d
Compare

Fixes #159
This PR add support for declaring path parameters on the path item object instead of the operation object. This feature is controlled by a new flag (
DeclarePathParametersOnPathItem) onOpenApiConvertSettingsExample usage:
Example output
'/Airports/{IcaoCode}': description: Provides operations to manage the collection of Airport entities. get: tags: - Airports.Airport summary: Get entity from Airports by key operationId: Airports.Airport.GetAirport parameters: - - name: IcaoCode - in: path - description: 'key: IcaoCode of Airport' - required: true - schema: - type: string - x-ms-docs-key-type: Airport - name: $select in: query description: Select properties to be returned style: form explode: false schema: uniqueItems: true type: array items: enum: - Name - IcaoCode - IataCode - Location type: string - name: $expand in: query description: Expand related entities style: form explode: false schema: uniqueItems: true type: array items: enum: - '*' type: string responses: '200': description: Retrieved entity content: application/json: schema: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport' default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation patch: tags: - Airports.Airport summary: Update entity in Airports operationId: Airports.Airport.UpdateAirport parameters: - - name: IcaoCode - in: path - description: 'key: IcaoCode of Airport' - required: true - schema: - type: string - x-ms-docs-key-type: Airport requestBody: description: New property values content: application/json: schema: $ref: '#/components/schemas/Microsoft.OData.Service.Sample.TrippinInMemory.Models.Airport' required: true responses: '204': description: Success default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation delete: tags: - Airports.Airport summary: Delete entity from Airports operationId: Airports.Airport.DeleteAirport parameters: - - name: IcaoCode - in: path - description: 'key: IcaoCode of Airport' - required: true - schema: - type: string - x-ms-docs-key-type: Airport - name: If-Match in: header description: ETag schema: type: string responses: '204': description: Success default: $ref: '#/components/responses/error' x-ms-docs-operation-type: operation + parameters: + - name: IcaoCode + in: path + description: 'key: IcaoCode of Airport' + required: true + schema: + type: string + x-ms-docs-key-type: Airport