OpenAPI tutorial step 8: The externalDocs object

The externalDocs object lets you link to external documentation. You can also provide links to external docs in the paths object.

Example externalDocs object

Here’s an example of an externalDocs object:

  description: Full documentation for the API

In the Swagger UI, this link appears after the API description along with other info about the API.

externalDocs object

See the related topic, Integrating Swagger UI with the rest of your docs for tips on how to integrate your Swagger UI output into your regular documentation.

Seeing the finished result

Now that we’ve completed all the steps in the tutorial, we’re finished building our OpenAPI document. You can see the end result here: docs/rest_api_specifications/openapi_weather.yml.

Here’s the specification document embedded in Swagger UI:

You can actually insert any valid path to an OpenAPI specification document into the “Explore” box in Swagger UI (assuming it’s using a version that supports your version of the spec), and it will display the content.

Get new posts delivered straight to your inbox.

Subscriber count: 4,285