Forum Discussion
Hi vgflores,
I'm not sure what you're using to annotate your code for generation of the Swagger docs .... but if you're using something like SwashBuckle, then you could leverage it's IDocumentFilter that walks through the generated SwaggerDocument and remove certain PathItems (e.g. swaggerDoc.paths["/mypath"]) or individual operations within a path (e.g. swaggerDocs.paths["/mypath"].get = null).
Example:
public class FilterRoutesDocumentFilter : IDocumentFilter {
public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer) {
swaggerDoc.paths["apirest/model/{param1}/{param2}/{param3}/{param4}/{param5}"].get = null;
}
}
Check out what's possible in your annotation tooling.
Kind regards,
Frank
vgflores wrote:
Hi everyone!
I want to hide a route (no show in swagger documentation). Example:
[Route("apirest/model/{param1}/{param2}/{param3}/{param4}")] - SHOW
[Route("apirest/model/{param1}/{param2}/{param3}/{param4}/{param5}")] – NO SHOW
public HttpResponseMessage Getvalues(string param1, string param2, string param3, double param4, string param5="")
Please help!!
Related Content
- 3 years ago
- 9 years ago
Recent Discussions
- 4 days ago
- 26 days ago