11 Documenting APIs with OpenAPI

This chapter covers

  • Understanding OpenAPI and seeing why it’s useful
  • Adding an OpenAPI description to your app
  • Improving your OpenAPI descriptions by adding metadata to endpoints
  • Generating a C# client from your OpenAPI description

In this chapter I introduce the OpenAPI specification for describing RESTful APIs, demonstrate how to use OpenAPI to describe a minimal API application, and discuss some of the reasons you might want to do so.

In section 11.1 you’ll learn about the OpenAPI specification itself and where it fits in to an ASP.NET Core application. You’ll learn about the libraries you can use to enable OpenAPI documentation generation in your app and how to expose the document using middleware.

Once ...

Get ASP.NET Core in Action, Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.