دنبال کننده ها

۱۳۹۷ فروردین ۲۰, دوشنبه

asp.net core - Swashbuckle Swagger: How to show type of array of models parameter?

[ad_1]



I am using vvatest 2.4 version of https://github.com/domaindrivendev/Swashbuckle.AspNetCore to generate documentation for AspNetCore Controller method having 2 parameters: guid and list of models.



[HttpPost("MyMethod/ReferenceId")]
public async Task<IActionResult> MyMethod(Guid referenceId, List<ApiProfile> passengers)


The first parameter generates correctly, but the second doesn't understand type and shows



Passengers
array
(query)



And in json:



"parameters": ["name": "passengers","in": "query","description": "",
"required": false,"type": "array","items": ,"collectionFormat": "multi",


Note that the type ApiProfile is shown at the bottom under Models section:



ApiProfile
description: API Object
Id string($uuid)
Email string
salutation string
firstName string
lastName string
dateOfBirth string($date-time)



And in json:



"definitions": {"ApiProfile": {"description": "API Object","type": "object",
"properties": {"Id": "format": "uuid","type": "string","Email": "type": "string",
"salutation": "type": "string","firstName": "type": "string"...


I need an advice how to describe type of List of request parameters to be shown in Swagger UI.



I've tried to assign [SwaggerRequestExample(typeof(PeopleRequest), typeof(ListPeopleRequestExample))] but not sure how to do it with 2 parameters.
Also I tried to temporary exclude first parameter, but have the same behaviour.




[ad_2]

لینک منبع