Repository metrics
- Stars
- (6,291 stars)
- PR merge metrics
- (No merged PRs in 30d)
Description
Hello,
when creating a swagger from a http GET method that uses several [FromUri] complex types the argument names are not prefixed correctly.
E.g. I have a complex type Period: Public Class Period Public Property Start As DateTime = DateTime.MinValue Public Property [End] As DateTime = DateTime.MaxValue End Class
And a controller method public IHttpActionResult GetAppointments(int? agendaId = null, int? departmentId = null, [FromUri]ExternalId externalId = ExternalId.Empty, [FromUri]Period startTimeSearchPeriod = null, [FromUri]Period endTimeSearchPeriod = null, int? ticketNumber = null, ConditionFlags? conditions = null, bool includeReferences = false) { return RunUnitOfWork(new GetAppointments(this.Db, agendaId, departmentId, externalId, startTimeSearchPeriod, endTimeSearchPeriod, ticketNumber, conditions, includeReferences)); }
This should result in a swagger (SwashBuckle) with arguments { name: "searchPeriod.start", in: "query", required: false, type: "string", format: "date-time" }, { name: "searchPeriod.end", in: "query", required: false, type: "string", format: "date-time" },
However, NSWAG gives: { "type": "string", "name": "Start", "in": "query", "x-nullable": false, "description": "The start of the period. Minimum time as default", "format": "date-time" }, { "type": "string", "name": "End", "in": "query", "x-nullable": false, "description": "The end of the period. Maximum time as default", "format": "date-time" },
This means that you get duplicate arguments if there is more than one Period as an argument in the generated C# client.
Of course there is a workaround by using an encompassing model, but then again, this should work as such. Maybe I am doing something wrong? I am using NSWAGStudio.
Cheers Yves