openapi-designer icon indicating copy to clipboard operation
openapi-designer copied to clipboard

Allow loading spec file by url parameter

Open brylie opened this issue 7 years ago • 8 comments

It would be nice to share a link to edit or view an OpenAPI Spec file, where the specification would automatically load. E.g. when sharing changes with a reviewer, I could share a link where the OpenAPI spec file would automatically be displayed.

If it is not already possible, consider adding a URL parameter that could be used to auto-populate the OpenAPI Designer with a spec file located somewhere on the web.

brylie avatar Sep 06 '17 11:09 brylie

This would also solve a problem in APInf platform. Currently, if you have an existing OpenAPI spec in the Documentation tab and if you press Open Editor button, a blank editor is opened. We would like to open the existing file for editing.

bajiat avatar Sep 13 '17 10:09 bajiat

@bajiat I think the APInf platform integration problem is #327. URL parameters (actually client-side URL hashes, since designer doesn't have a webserver backend) that load specific APIs are probably more useful when using the designer as a standalone website.

tulir avatar Sep 13 '17 10:09 tulir

This issue may be a possible solution. In effect, we would just pass the URL of the uploaded OpenAPI file to the OpenAPI Designer as a URL parameter. The user could edit the file, save it to OpenAPI Space, and somehow link the new file to their APInf API.

We haven't fleshed out the idea fully, but intuitively feel this is a related task.

brylie avatar Sep 13 '17 10:09 brylie

For sharing documents, I think we should just have an URL hash with the information needed to fetch the correct document from Space rather than the full URL. Though we'll definitely want a way to import a spec from any URL in the UI and in the postMessage API. All platform integration related things should probably use the postMessage API.

tulir avatar Sep 13 '17 11:09 tulir

The use case here is that people might want to load any web accessible spec file. E.g. a specfile that is located on GitHub.

I opened this issue, because I was writing a specfile that is being stored on GitHub, and want to share it with other collaborators for review.

brylie avatar Sep 13 '17 11:09 brylie

By way of example, Swagger UI will render any OpenAPI file that is web accessible (when provided as a URL parameter url).

  • http://petstore.swagger.io/?url=https://raw.githubusercontent.com/CiviWiki/OpenCiviWiki/dev/docs/design/bill_api.json

brylie avatar Sep 13 '17 11:09 brylie

I guess we can do that too, but it'll probably require escaping if we want IE/Edge compatibility

tulir avatar Sep 13 '17 11:09 tulir

Cool, it's just a feature request. I just want to make sure there is enough clarity about the request.

brylie avatar Sep 13 '17 11:09 brylie