AI Answers

AI Answers

Every once in a while I ask myself a pretty general overview question. Normally I poke around the programming subreddit or maybe look on Stack Overflow. AI has been kind of useful for not making any real decision but just summarizing the internet zeitgeist the same way I would doing initial discovery. I still read what AI gives me with extreme prejudice and come up with my own conclusions but I must admit it does do a great job at presenting most alternatives and their arguments.

I recently wondered if there was a well-known location to put OpenAPI specs. In the past days of SOAP APIs there was a path for the WSDL file (Web Service Description Language) that defined the API. There were plenty of bad ideas around SOAP but the service discovery was not among them (IMO).

Let’s see what Gemini had to say:

The OpenAPI Specification (OAS) does not define a single official “well-known location” or mandatory file path for its documents. The location is determined by the implementation of the API or server hosting the file.

However, several common conventions and emerging standards exist for discoverability:

Common Conventions and Best Practices

/api-docs: This is a widely used conventional endpoint for hosting documentation.

Emerging Standards for Discovery

/.well-known/api-catalog: RFC 9727 defines this specific location for an API catalog, which is a document (using the Linkset format) that can point to multiple API descriptions.

In practice, the exact location depends entirely on how the API provider or web framework has configured the service.

That’s pretty cool. Apparently the SOAP .well-known system is an IETF RFC now. Or, maybe it was then too, I don’t know.

At any rate it looks like just putting openapi.yaml at the root of the service is a simple and mostly acceptable way of doing things. I’ll probably just do that. It’s also worth noting that the online Swagger tool is often exposed via /api-docs. That seems like a good idea too, I’ll probably do that.