liveBook · Manning

Swagger UI

As explained in ASP.NET Core in Action, 3e

Swagger UI is a web-based interface that visualizes an API description and enables interactive API requests.

Swagger UI is a web interface for exploring and testing an API described with OpenAPI. It lists endpoints, schemas, and possible responses, then lets you send requests and inspect the results. For local testing, it can replace a heavier tool such as Postman. section 11.2

Add Swagger UI to an ASP.NET Core application with Swashbuckle:

  • Open /swagger while the application is running. section 11.2
  • Choose an endpoint, select Try it out, enter parameter values, and select Execute. section 11.2

Testing a documented endpoint

A GET endpoint may be documented as returning 200. Running it through Swagger UI can reveal an actual 404 response, showing why endpoint metadata should describe every possible result. section 11.2

Swagger UI derives its interface from the OpenAPI document, so accurate endpoint metadata determines the quality of the displayed schemas and responses. Authentication can also be tested by declaring a security scheme and protected endpoints in that document. section 11.2 section 25.5

Bearer authentication

Configure bearer authentication in the OpenAPI document, generate a token with user-jwts, and enter Bearer <token> in Swagger UI. The UI attaches the token to subsequent requests. section 25.5

Swagger UI works best for straightforward OpenAPI-described APIs and local testing. HATEOAS-driven APIs, combined gateway documents, advanced authentication extensions, and newer specification features may exceed its support or require workarounds. section 11.6.1 section 11.6.3

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains middleware setup, request execution, displayed responses, authentication configuration, and practical limits without detailing UI internals.
Examples
Uses /swagger navigation, Try it out requests, response inspection, a 404 documentation mismatch, and bearer-token authorization.
What it assumes
Assumes an ASP.NET Core API with an OpenAPI document and introduces browser-based exploration before advanced authentication testing.
What you can do after
Operate Swagger UI to explore endpoints, send parameterized requests, inspect responses, and test protected APIs with bearer tokens.
How it connects
Connects OpenAPI, ASP.NET Core, Swashbuckle, Postman, authentication, authorization, bearer tokens, HATEOAS, and API gateways.

Also explained in

Compare how 3 books explain Swagger UI →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.