Nancy.Swagger
Nancy.Swagger copied to clipboard
Parameter types are not removed from route path strings
Expected Behavior
A typed parameter in a Nancy route is included without type in a route path in swagger.json.
Actual Behavior
The parameter type remains in the route path in swagger.json.
Steps to Reproduce the Problem
- Use a Nancy route with typed parameter like
/something/{id:guid}
- Generate swagger.json
- Inspect the route path, it is
/something/{id:guid}
Analysis
SwaggerRouteData
contains a properly sanitized Path
property, but it appears that the actual route path being used is the key of the dictionary returned by ISwaggerMetadataProvider.RetrieveSwaggerPaths
, and that is the raw route path.
My workaround in a custom metadata provider:
protected override IDictionary<string, SwaggerRouteData> RetrieveSwaggerPaths(NancyContext context)
{
var result = base.RetrieveSwaggerPaths(context);
return result.Values.ToDictionary(rd => rd.Path);
}
Specifications
- Version: 2.2.59-alpha
- Project: ?
- Platform: .NET Core 3.0
- Subsystem: ?