Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Import from swagger-ui spec #37

Open
josser opened this issue Aug 3, 2017 · 3 comments
Open

Feature request: Import from swagger-ui spec #37

josser opened this issue Aug 3, 2017 · 3 comments

Comments

@josser
Copy link

josser commented Aug 3, 2017

It would be great to import not just from plain json file but from swgger-ui url itself.
There are several scenarios why it may be useful:

  1. User don't know the url to .json file but know swagger-ui endpoint.
  2. User don't have .json spec in file but it's included directly in swagger-ui and auto-regenerated each time, i.e:
    swagger_ui_spec_in_jscode

Also, not sure about correct place to ask, but: is it possible to auto-refresh endpoints definitions to keep them in sync with actual spec?

@JonathanMontane
Copy link
Contributor

@josser There are quite a few issues I see with this:

  1. No two swagger-ui endpoint seem to have the same loading structure (some point to a url, some have the spec included as a js object, some build the spec on execution, etc.), which makes it very unstable to parse.
  2. Executing the code instead of just parsing it would be a strong security risk.

@josser
Copy link
Author

josser commented Aug 3, 2017

@JonathanMontane I agree about 2)
I've tried to figure out how it's possible to parse without something huge like esprima and now I'm understand that it may be too complex task. Regexps are not looking promising :)
However, i'm still looking for a way to import generated on the fly spec into paw

@JonathanMontane
Copy link
Contributor

@josser If it is only for your personal use case, you can make a fork of API-Flow (https://github.com/luckymarmot/API-Flow). It's the underlying converter that we created for API description formats imports. All you'd need to do is create an additional loader for that can handle the index.html file that contains the swagger-ui bundle with the spec (that's where the regex spec1 = ({.*}) comes in useful)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants