When I import an OpenAPI spec that has external $refs, it imports fine if I import the folder from disk (where the folder has all the relevant files), but importing from URL doesn’t work – although the references are valid relative URLs. By comparison, the Swagger UI that uses the same source specs correctly resolves those refs.
For example, in my openapi.json
I have a reference like:
{
"$ref": "getall-query-params.json#/components/parameters/filter"
},
If my openapi.json
URL is, for example, http://localhost:9001/api-docs/openapi.json
, the relative URL resolves to http://localhost:9001/api-docs/getall-query-params.json
, and that resource is available and can be accessed.
And these $refs are resolved correctly either by Swagger UI OR if I import a folder to Postman, where the folder contents are:
getall-query-params.json
openapi.json
But if I import to Postman just using the URL http://localhost:9001/api-docs/openapi.json
, it imports most of the spec just fine but misses those external refs.