Unbound actions generate invalid swagger
Closed this issue · 2 comments
In my OData endpoint I have several unbound actions. When I copy/paste the generated swagger on https://editor.swagger.io it gives me an error on every unbound actions I have. See image below.
The swagger of that action looks like this:
/odata4/v14/GetInstalledOperations:
get:
tags:
- Providers
summary: Gets the installed operations.
operationId: Providers_GetInstalledOperations_1
consumes: []
produces:
- application/json
parameters:
- name: addInPackageId
in: body
description: 'parameter: addInPackageId'
required: false
schema:
type: object
- name: filter
in: body
description: 'parameter: filter'
required: true
schema:
type: object
- name: parameters
in: body
description: The parameters.
required: true
schema:
type: object
additionalProperties:
type: object
responses:
'200':
description: OK
schema:
$ref: '#/definitions/Swashbuckle.OData.ODataResponse[System.Collections.Generic.List[MyApp.ProviderInfo]]'
deprecated: false
If I look at an entity bound action everything looks fine.
/odata4/v14/ContentLibraryFiles/Compare:
get:
tags:
- ContentLibraryFiles
summary: Compares two files based on the supplied parameters.
operationId: ContentLibraryFiles_Compare_1
consumes:
- application/json
produces:
- application/json
parameters:
- name: parameters
in: body
description: The parameters.
required: false
schema:
type: object
properties:
originalFileId:
format: guid
type: string
revisedFileId:
format: guid
type: string
responses:
'200':
description: OK
schema:
$ref: '#/definitions/Swashbuckle.OData.ODataResponse[System.Collections.Generic.List[System.Byte]]'
deprecated: false
@rbeauchamp I can produce a sample project if you want.
I debugged the code and I believe the problem is in Swashbuckle.OData.Descriptions.ODataSwaggerUtilities.CreateSwaggerPathForOperationImport
Looks like every parameter are added as body parameter in the swagger. I don't know if this is intentional/normal or not. If you provide me with enough detail I could fix the issue and create a PR (if this is an issue).
I finally fixed the issue. I should have a PR soon on this.