apinf / openapi-designer

Design interface for creating Open API (Swagger) specification files
https://openapi.design
MIT License
69 stars 18 forks source link

Allow loading spec file by url parameter #340

Open brylie opened 7 years ago

brylie commented 7 years ago

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.

bajiat commented 7 years ago

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.

tulir commented 7 years ago

@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.

brylie commented 7 years ago

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.

tulir commented 7 years ago

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.

brylie commented 7 years ago

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 commented 7 years ago

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

tulir commented 7 years ago

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

brylie commented 7 years ago

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