axnsan12 / drf-yasg

Automated generation of real Swagger/OpenAPI 2.0 schemas from Django REST Framework code.
https://drf-yasg.readthedocs.io/en/stable/
Other
3.4k stars 435 forks source link

swagger_settings.DEFAULT_API_URL is not working #681

Open CoreJa opened 3 years ago

CoreJa commented 3 years ago

https://github.com/axnsan12/drf-yasg/blob/b99306f71c6a5779b62189df7d9c1f5ea1c794ef/src/drf_yasg/generators.py#L189-L197

as your code here, url from swagger_settings.DEFAULT_API_URL is read by generator but never used.

I appended two lines after if parsed_url.path: like this:

            if parsed_url.path:
                ...
            else:
                self._gen.url = url

Then it works. I'm making a pr if that's fine with you.

CoreJa commented 3 years ago

I've made a pr here.