Django-rest-swagger can't read my api.

594 views
Skip to first unread message

Nick Vrionis

unread,
Oct 8, 2015, 9:21:59 AM10/8/15
to Swagger
Hello, I have installed django-rest-swagger 0.3.2 i already have an API using djangorestframework==2.4.0 Django==1.7.1 running on debian 8.

My problem is that after following the instruction on git still i cant seem to enjoy a nice auto generated documentation. i can see my endpoints in json format in the given url but it is like swagger-ui can not read them. Any idea what might be doing that?

Thanks in advance.

Ron Ratovsky

unread,
Oct 8, 2015, 11:58:37 AM10/8/15
to Swagger
Can you share the json you're getting?

--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
-----------------------------------------
http://swagger.io
https://twitter.com/SwaggerApi
-----------------------------------------

Nick Vrionis

unread,
Oct 8, 2015, 1:23:25 PM10/8/15
to swagger-sw...@googlegroups.com
Ok sure whatever helps.

my API endpoints as read in http://127.0.0.1:8000/docs/api-docs/

{
  • "swaggerResourcesView": {
    • "info": {
      • "description": "",
      • "license": "",
      • "title": "",
      • "contact": "",
      • "termsOfServiceUrl": "",
      • "licenseUrl": ""
      },
    • "basePath": "http://127.0.0.1:8000/docs/api-docs",
    • "swaggerVersion": "1.2",
    • "apiVersion": "0.1.10",
    • "apis": [
      • {
        • "path": "/api/clusterchoices"
        },
      • {
        • "path": "/api/clusters"
        },
      • {
        • "path": "/api/dsls"
        },
      • {
        • "path": "/api/hdfs"
        },
      • {
        • "path": "/api/jobs"
        },
      • {
        • "path": "/api/newsitems"
        },
      • {
        • "path": "/api/orkaimages"
        },
      • {
        • "path": "/api/settings"
        },
      • {
        • "path": "/api/statistics"
        },
      • {
        • "path": "/api/users"
        },
      • {
        • "path": "/api/vreimages"
        },
      • {
        • "path": "/api/vreservers"
        }
      ]
    }
}


and if i go to an endpoint eg http://127.0.0.1:8000/docs/api-docs/api/clusterchoices I have

{
  • "swaggerApiView": {
    • "swaggerVersion": "1.2",
    • "apis": [
      • {
        • "operations": [
          • {
            • "parameters": [ ],
            • "nickname": "Status_GET",
            • "notes": "<p>View to handle requests for retrieving cluster creation parameters\nfrom ~okeanos and checking user's choices for cluster creation\ncoming from ember.<br />\n</p>\n<p>Return a serialized ClusterCreationParams model with information\nretrieved by kamaki calls. User with corresponding status will be\nfound by the escience token.</p>",
            • "summary": "Return a serialized ClusterCreationParams model with information",
            • "type": "object",
            • "method": "GET"
            },
          • {
            • "parameters": [ ],
            • "nickname": "Status_PUT",
            • "notes": "<p>View to handle requests for retrieving cluster creation parameters\nfrom ~okeanos and checking user's choices for cluster creation\ncoming from ember.<br />\n</p>\n<p>Handles ember requests with user's cluster creation parameters.\nCheck the parameters with HadoopCluster object from create_cluster\nscript.</p>",
            • "summary": "Handles ember requests with user's cluster creation parameters",
            • "type": "object",
            • "method": "PUT"
            },
          • {
            • "parameters": [ ],
            • "nickname": "Status_DELETE",
            • "notes": "<p>View to handle requests for retrieving cluster creation parameters\nfrom ~okeanos and checking user's choices for cluster creation\ncoming from ember.<br />\n</p>\n<p>Delete cluster from ~okeanos.</p>",
            • "summary": "Delete cluster from ~okeanos",
            • "type": "object",
            • "method": "DELETE"
            }
          ],
        • "path": "/api/clusterchoices",
        • "description": "View to handle requests for retrieving cluster creation parameters"
        }
      ],
    • "models": { },
    • "basePath": "http://127.0.0.1:8000",
    • "resourcePath": "/api/clusterchoices",
    • "apiVersion": "0.1.10"
    }
}





--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/4N4eY2ARmWk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.

Nick Vrionis

unread,
Oct 8, 2015, 1:23:53 PM10/8/15
to swagger-sw...@googlegroups.com
Now i have it at local host but when i try use a server i had the same results

Ron Ratovsky

unread,
Oct 8, 2015, 2:39:51 PM10/8/15
to Swagger
Great, thanks. Which version of swagger-ui do you try to use when you load that json?

Nick Vrionis

unread,
Oct 8, 2015, 4:41:43 PM10/8/15
to swagger-sw...@googlegroups.com
Not sure I have installed django-rest-swagger == 0.3.2 with pip,  swagger version is 1.2 swagger-ui not sure which version it uses I asumed it installs a compatible version with the package.

Ron Ratovsky

unread,
Oct 8, 2015, 4:45:44 PM10/8/15
to Swagger
I'm not that familiar with the django-rest-swagger. Can you look at the top of the swagger-ui.js file that you have? The information should be there.

Nick Vrionis

unread,
Oct 9, 2015, 7:15:07 AM10/9/15
to swagger-sw...@googlegroups.com
I do not have a swagger-ui.js file i thought it would be produced be rest-swagger maybe i should use Swagger ui and do not expect it to be auto generated from my django api

Ron Ratovsky

unread,
Oct 9, 2015, 4:31:50 PM10/9/15
to Swagger
I'm not really familiar with what django-rest-swagger does so not sure how to help there. However, you should definitely try using the swagger-ui directly.

Nick Vrionis

unread,
Oct 13, 2015, 5:27:09 AM10/13/15
to swagger-sw...@googlegroups.com
Hello again! I have changed my view a bit and there is some improvement but I think I might have locate the problem in top of my swagger.js file version is 2.0.27 

and when I am trying to load the swagger UI i have the following error:

TypeError: response.apis is undefined swagger.js:213
Array [ "This API is using a deprecated version of Swagger!  Please see http://github.com/wordnik/swagger-core/wiki for more info" ] swagger-ui.min.js:1
TypeError: response.apis is undefined swagger.js:213
Array [ "This API is using a deprecated version of Swagger!  Please see http://github.com/wordnik/swagger-core/wiki for more info" ]


should I go to a previus swagger version? is 2.0.27 stable?

Ron Ratovsky

unread,
Oct 13, 2015, 5:29:59 PM10/13/15
to Swagger
It's stable, but there are newer version of it. The latest version of swagger-js with direct 1.2 support was 2.0.49.
Reply all
Reply to author
Forward
0 new messages