2

I just started using swagger for my API documentation. I followed these docs , but more then half of the urls were excluded by swagger.

As you can see in image below, it is showing some urls but few urls are excluded and the urls displayed by swagger do not include full functionality like there is no body part to test the end points. If you click Try it out! it will send the request with blank params (no body to edit request params).

Below is my urls file.

I have used include() to includes my app urls may be that is the reason but then how it is showing some urls and excluding some.

urlpatterns = [
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),

    url(r'^api/v3/', include('identify.routers_v3', namespace='v3')),

    # swagger schema url
    url(r'^docs/', schema_view), 

]

I have also checked the console and there are no errors in console. Also I am using djnago rest APIView

Error which I am getting in swagger browser screen is

{"schemaValidationMessages":[{"level":"error","message":"Can't read from file http://local.app.in:8000/docs/?format=openapi"}]}

enter image description here

user5594493
  • 1,050
  • 3
  • 10
  • 24
  • 1
    I switched to using Swagger UI and manually documenting the APIs, its not much effort – pragman Oct 12 '16 at 14:46
  • I have the same issue and I think I will go down the same route you went. there is a possibility to manually add and edit coreapi.Document object and generate the schema from that. If someone finds a solution for this, please give your answer. – Erika Oct 20 '16 at 09:09
  • @Erika use this issue on github repo, I have asked his question and the issue was fixed. https://github.com/marcgibbons/django-rest-swagger/issues/562 – user5594493 Oct 20 '16 at 10:12
  • @Erika I have also answered my question , Hope it helps – user5594493 Oct 20 '16 at 10:18

1 Answers1

2

- All urls are not mapped : The above is is due to request param passed in get_schema() function , if you remove request , your issue will be fixed.

  • schemaValidationMessages - It was due to invalid domain, the domain was accessible with in the intranet as soon as I used localhost, the issue gets fixed.

I have asked similar question on swagger github repo so for more info refer to this issue on swagger git repo :

https://github.com/marcgibbons/django-rest-swagger/issues/562

user5594493
  • 1,050
  • 3
  • 10
  • 24