API documentation doesn't show up in swagger ui
Closed this issue · 1 comments
I cloned this repository in my machine and ran example.py. The responses from the urls are as follows;
- http://localhost:5000/api/v1/cheese.json
- {"swaggerVersion": "1.0", "apis": [{"operations": [{"httpMethod": "GET", "resource": "cheese", "parameters": [{"name": "cheeseName", "dataType": "str", "paramType": "path", "required": true, "allowMultiple": false, "description": "The name of the cheese to fetch"}], "path": "/cheese.{format}/{cheeseName}", "errorResponses": [{"reason": "Sorry, we're fresh out of that cheese.", "code": 400}, {"reason": "I'm actually a teapot", "code": 418}], "summary": "Gets cheese, just like the name says."}], "path": "/cheese.{format}/{cheeseName}", "description": ""}], "models": [], "basePath": "http://localhost:5000/api/v1", "resourcePath": "cheese", "apiVersion": "1.0"}
- http://0.0.0.0:5000/api/v1/resources.json
- {"models": {"SomeCrazyClass": {"id": "SomeCrazyClass", "properties": {"age": {"required": true}, "birthday": {"default": "tomorrow", "required": false}, "name": {"required": true}}}}, "basePath": "http://localhost:5000/api/v1", "swaggerVersion": "1.0", "apiVersion": "1.0", "apis": [{"path": "cheese.{format}", "description": ""}, {"path": "holyHandGrenade.{format}", "description": ""}]}
None of these responses work while using as a server resource for documenting the API in swagger ui (latest one in github). The error that I get while using any one of them is;
Can't read from server. It may not have the appropriate access-control-origin settings.
How can i see the api documented in swagger ui?
Thanks
Hey @kailashbuki --
Thanks for pointing this out. I've integrated your changes, made a few of my own (so it works on heroku), and then made a few cosmetic changes.
You can see my example API on display here:
http://sillywalk.herokuapp.com/api/v1/resources.json
And you can use the Swagger API explorer to poke around here:
http://petstore.swagger.wordnik.com/ -- just enter the URL above in the bar.
When I get more time I need to make it more complete, with complex models. I also need to integrate it into a proper Flask plugin.
Thanks!