liveBook · Manning

Swagger

As explained in Building Web APIs with ASP.NET Core

Swagger is a set of tools for describing, documenting, and interacting with HTTP APIs.

Swagger is a toolset for describing, documenting, and interacting with HTTP APIs. The related OpenAPI specification defines a language-agnostic, human-readable contract that lets clients understand and use endpoints without reading server source code. In ASP.NET Core, Swashbuckle supplies services, middleware, attributes, and filters for generating and customizing this documentation. section 3.2.1 section 11.5

Useful Swagger documentation should make an API practical for its different developer audiences by:

  • Describing endpoints, input parameters, responses, and representative requests and responses. section 11.5
  • Grouping related endpoints, emphasizing authorization requirements, and customizing the documentation context. section 11.5
  • Using Swashbuckle’s attributes and filter pipeline to improve operation descriptions and add custom key/value data to generated JSON schemas. section 11.5

Verify documented API operations

Use Swagger UI to execute newly created gRPC wrapper operations and confirm that they work. Treat authorization as part of the verification: update methods must be accessible only to users with the Moderator role. section 10.5.5

Swagger/OpenAPI is especially useful when an API has no user interface to reveal its capabilities. Its generated documentation gives human readers and parsers a discoverable view of the interface, while remaining connected to REST concerns such as a uniform interface, HATEOAS, and API versioning. section 3.5 section 3.2.1

How Building Web APIs with ASP.NET Core covers it

How deep it goes
Explains the OpenAPI contract and Swashbuckle customization through practices, attributes, filters, and verification, without detailing generated internals.
Examples
Uses endpoint descriptions, request and response samples, generated swagger.json, Swashbuckle filters, and Swagger UI tests for gRPC wrappers.
What it assumes
Assumes familiarity with web APIs and ASP.NET Core while defining the OpenAPI contract and documentation practices explicitly.
What you can do after
Apply it via Swashbuckle and Swagger UI to document, customize, and verify ASP.NET Core API operations.
How it connects
Connects Swagger with OpenAPI, REST, uniform interface, HATEOAS, API versioning, authorization, and Swashbuckle.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Building Web APIs with ASP.NET Core. The section links point to the parts of the book it draws on.