Monthly Archives: November 2017

ASP.NET WEB API documentation using Swagger – Extend schema generation using SchemaFilters and FluentValidation rules

In this post we will see how to extend schema generation using FluentValidation rules. We will see how to display min/max constraints for Integer type in Swagger UI and how to extend default examples to show valid email for email attribute.To … Continue reading

Posted in ASP.NET, Documentation, WEB API | Tagged , | Leave a comment

ASP.NET Web API documentation using Swagger – Useful links

Some of good additions to Swagger might be quite difficult to find so I put useful links here: Generating model examples: https://mattfrear.com/2015/04/21/generating-swagger-example-responses-with-swashbuckle #1 https://mattfrear.com/2016/01/25/generating-swagger-example-requests-with-swashbuckle #2 https://github.com/mattfrear/Swashbuckle.Examples Using markdown in descriptions: It is possible to render really cool description in Swagger … Continue reading

Posted in Documentation, WEB API | Tagged , | Leave a comment

ASP.NET Web API documentation using Swagger – Use schema mapper for generic data types

If get back to previous post, you could see that descriptions for StartDate and EndDate are duplicated. DateTime description shall be consistent across all API, so to not repeat yourself let’s use MapType feature of Swashbuckle configuration. Open SwaggerConfig and … Continue reading

Posted in Documentation, WEB API | Tagged , | Leave a comment

ASP.NET Web API documentation using Swagger – Add custom headers

In this post, we will look into how to add custom headers to your Swagger documentation using Swashbuckle. We will add well-known “Accept-Language” header with conditionally visibility based on API method! Setup application culture based on Accept-Language header First, add … Continue reading

Posted in Documentation, WEB API | Tagged , | Leave a comment