RicoSuter/NSwag

Route constraint shown as "string" in UI

Open

#745 opened on Apr 28, 2017

View on GitHub
 (5 comments) (1 reaction) (0 assignees)C# (1,189 forks)batch import
help wantedproject: NSwag.SwaggerGeneration.WebApitype: bug

Repository metrics

Stars
 (6,291 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

Hi, the documentation says the WebApiToSwaggerGenerator supports "RouteAttribute and ActionNameAttribute on the action method, with support for Route constraints (e.g. [Route("users/{id:int}"])".

Given the following controller action as an example:

[Route("test/{modelToUpdate:guid}")]
public IHttpActionResult UpdateTest([FromUri] TestModel modelToUpdate) {

The swagger UI shows the parameter data type for modelToUpdate as "string". Could reproduce the same if used :int as constraint. The UI always says "string".

Am I missing a special swagger attribute or something?

Thank, bergziege

Contributor guide