Open tommyjcarpenter opened 8 years ago
You are on top of our stuff, right now we only support swagger 1.2, which is kind of outdated. but we are building the new version for new versions also. Here's the link to keep you informed (it will be merged soon): https://github.com/flask-restful-swagger/flask-restful-swagger
When pasting to online validator, it validates against 2.0 specs. And fails for older ones.
@sobolevn thanks for your response!
is there another way I can figure out what I did wrong then? On the main API page I just see: spec : test Show/Hide List Operations Expand Operations Raw [ base url: http://localhost:5000/api/spec/_/resource_list.json , api version: 0.1 ]
but when I click "Raw" I see models, APIs, the whole shebang.
@tommyjcarpenter can you please upload a sceenshot?
@sobolevn Here are screenshots:
http://s16.postimg.org/dgg4webd1/Screen_Shot_2016_03_22_at_8_37_14_AM.png
http://s16.postimg.org/tu4ptagw5/Screen_Shot_2016_03_22_at_8_37_19_AM.png
First screenshot is the missing swagger endpoints, second is what I see when I click raw.
The only thing I did to my project was add
###################################
# Wrap the Api with swagger.docs. It is a thin wrapper around the Api class that adds some swagger
# smarts
api = swagger.docs(Api(app), apiVersion='0.1')
###################################
And the example @swagger.operation annotation you have in your readme.
What happens when you press Show/ Hide
? Any errors in the console?
Nothing happens, no errors. The only thing I can see is the url changes to http://localhost:5000/api/spec.html#!/spec
instead of http://localhost:5000/api/spec.html
Flask logs show all 200s
A bit hasty to close issues with "invalid" on people trying to use your library there
On Mar 22, 2016, at 8:57 AM, Sobolev Nikita notifications@github.com wrote:
Reopened #94.
— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub
I guess, I have managed to repeat you issue. Here's my json, which I had when the issue was pretty similar to yours: http://pastie.org/10769893
As you can see, it's pretty similar. But, we are missing the dataType
parameter. The difference is, that I'm having an issue in the console. http://i.imgur.com/1z1Nxbi.png
Fixed json: http://pastie.org/10769890#15 To fix your code, add this line:
@swagger.operation(
...
parameters=[
{
...
"dataType": "string", # here
}
Does this help?
Will try it out later, thanks. Yes you had something like ModelClass in the README but I didn't know what that referred to, and later you had ModelClass2, so I just removed those lines. Maybe add a note to the readme that this parameter is required and what ModelClass is.
Or maybe add string as a default for dataType
?
Thank you, sure.
Still not seeing the API. My JSON now looks like:
{
"apiVersion": "0.1",
"apis": [
{
"description": "Describing elephants",
"notes": null,
"operations": [
{
"method": "post",
"nickname": "upload",
"notes": "some really good notes",
"parameters": [
{
"allowMultiple": false,
"dataType": "string",
"description": "blueprint object that needs to be added. YAML.",
"name": "body",
"paramType": "body",
"required": true
}
],
"responseMessages": [
{
"code": 201,
"message": "Created. The URL of the created blueprint should be in the Location header"
},
{
"code": 405,
"message": "Invalid input"
}
],
"summary": null
}
],
"path": "/Docker"
}
],
"basePath": "http://localhost:5000",
"description": "Auto generated API docs by flask-restful-swagger",
"models": {},
"produces": [
"application/json"
],
"resourcePath": "/",
"spec_endpoint_path": "/api/spec",
"swaggerVersion": "1.2"
}
I have managed to create the same json, as you have: http://pastie.org/10770850
But, it is working for me. Please, show me the full code you have, maybe the issue is there.
That is difficult, because this was part of a work application, which I cannot post here. I have switched to https://github.com/gangverk/flask-swagger in the meantime. I will re-read your documentation afterwards.
When I stub out a new project according to the readme and head to http://localhost:5000/api/spec.html#!/spec, I don't see anything where the dropdown endpoints would show. I'm trying to debug this.
When I click
raw
, I get a json with all of the models and info I added using the decorators. When I paste that JSON into http://editor.swagger.io/#/, I get:Any ideas?