Paw-SwaggerImporter
Paw-SwaggerImporter copied to clipboard
Feature request: Import from swagger-ui spec
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:
- User don't know the url to .json file but know swagger-ui endpoint.
- User don't have .json spec in file but it's included directly in swagger-ui and auto-regenerated each time, i.e:

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?
@josser There are quite a few issues I see with this:
- 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.
- Executing the code instead of just parsing it would be a strong security risk.
@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
@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)