Skip to content

Instantly share code, notes, and snippets.

@jawn
Last active February 5, 2019 13:18
Show Gist options
  • Save jawn/52a679118503439585a2829770f8eac8 to your computer and use it in GitHub Desktop.
Save jawn/52a679118503439585a2829770f8eac8 to your computer and use it in GitHub Desktop.
.NET Framework: Web API Checklist (.NET Framework)

Swashbuckle installation and configuration

  • Use Swashbuckle to get Swagger API documentation at http(s)://website/swagger
  • Disable online Swagger validation to fix validation error on swagger page: uncomment c.DisableValidator() in SwaggerConfig.cs
  • Describe all enum values as string in swagger: uncomment c.DescribeAllEnumsAsStrings() in SwaggerConfig.cs
  • Add to automated build/deployment pipeline: expect HTTP Status 200 for GET /swagger/ui/index
  • Add to automated build/deployment pipeline: expect HTTP Status 200 for GET /swagger/docs/v1

Web API configuration

  • Add at end of Application_Start() in Global.asax.cs:
    // Serialize enum values as description instead of integers in JSON.
    HttpConfiguration config = GlobalConfiguration.Configuration;
    config.Formatters.JsonFormatter.SerializerSettings.Converters.Add(new StringEnumConverter());

API design guidelines

Out of scope of this document.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment