Forum Discussion

jak's avatar
jak
Regular Visitor
8 months ago

How to get OpenAPI 3.1 to recognize a $ref URL on the local file system?

I am trying to develop an API in OpenAPI 3.1 through the Swagger editor-next and I want to develop it in a modular fashion with the schema in separate files from the paths. I have tried the following, none of which seem to work:

 

- Loading the Swagger editor editor from the URL (editor-next.swagger.io) and using filenames on my local machine. I also tried a Google Drive URL in the $ref, but Google Drive seems to serve HTML and not text and the editor can't handle that.

- Installing the Docker container locally with the Swagger editor in it, mounting the directory with the API files into the Swagger container when the container is started and using file:///  URLs with the directory name where I mounted it in the container for the $ref. (I prefer this method if it would work).

- Installing the Swagger editor directly into the operating system using npm and using the file:///  URL with the directory name on the local file system where the files are in with the $ref.

 

How can I get a $ref URL that will let me reference other files from within an OpenAPI 3.1 definition so I can develop my API modularly?

No RepliesBe the first to reply