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

Please implement a Swagger/OpenAPI definition in JSON #96

Open
stephendonner opened this issue May 18, 2017 · 4 comments
Open

Please implement a Swagger/OpenAPI definition in JSON #96

stephendonner opened this issue May 18, 2017 · 4 comments

Comments

@stephendonner
Copy link

The Swagger/OpenAPI view/definition[0] for Shavar is only implemented in YAML.

For reference, I'm using http://shavar.stage.mozaws.net/__api__ - it returns an api file of content-type: application/x-yaml

AFAICT, it should also/primarily return its Swagger/OpenAPI definition file as JSON[1]; I ran into this as a problem when trying to use the OWASP ZAP OpenAPI add-on, to import, spider, and scan Shavar: https://zaproxy.blogspot.com/2017/04/exploring-apis-with-zap.html

As an additional example:

  1. Load http://editor.swagger.io/
  2. File | Import URL
  3. Input http://shavar.stage.mozaws.net/__api__

Actual Results:

"No spec provided." is returned

Expected Results:

If you input Kinto's definition URL, https://kinto.dev.mozaws.net/v1/__api__ you get a successful representation of its imported definition file, etc.

Thanks!

[0] https://github.com/mozilla-services/shavar/blob/1a92c9bcf7c5dc82f6a119699f42b1334622501f/shavar/views/swagger.py
[1] https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#specification
[2] https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#file-structure

screen shot 2017-05-18 at 4 39 41 pm

screen shot 2017-05-18 at 4 40 14 pm

@stephendonner
Copy link
Author

/cc @psiinon @tarekziade

@psiinon
Copy link

psiinon commented May 19, 2017

@stephendonner the ZAP add-on should already support yaml - we have tests for it that currently pass ;) https://github.com/zaproxy/zap-extensions/blob/alpha/test/resources/org/zaproxy/zap/extension/openapi/PetStore_defn.yaml
I'll have a play with http://shavar.stage.mozaws.net/__api__ and see if I can work out whats up. Assuming I can access that of course - is it only accessible via the VPN?

@tarekziade
Copy link
Contributor

Ideally, we should implement the Accept header so that URL returns JSON or Yaml depending on what the client wants (and pick a default one)

@psiinon
Copy link

psiinon commented May 19, 2017

@stephendonner I can import https://shavar.stage.mozaws.net/__api__ into ZAP without any apparent problems :)

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

3 participants