On the DRF github it appears there is an open Issue #
<https://github.com/encode/django-rest-framework/issues/6675>6675
<https://github.com/encode/django-rest-framework/issues/6675> that also
discusses this problem
On Thursday, July 18, 2019 at 12:49:01 PM UTC-7, Christopher Sund wrote:
>
> I have an API using DRF that is using a DefaultRouter and
> get_schema_view() to create an API schema page. The API is routed under
> "api/" using
>
> router = DefaultRouter(trailing_slash=False)
> ...
> urlpatterns = [
> path('api/', include(router.urls)),
> ...
> ]
>
> The generated schema, however does not provide the proper paths that
> include this prefix e.g. "/get-items" instead of "/api/get-items".
> Examining the code, it appears SchemaGenerator in openapi.py determines a
> path prefix in get_paths(). It then determines the subpath of each action
> by removing the leading prefix, but does not retain the prefix information.
> I have attempted to set the url and urlconf kwargs in get_schema_view() but
> they appear to have no effect on the generated schema. As a result of this
> prefix exclusion, tools that make use of the generated schema, e.g.
> SwaggerUI do not use the proper API endpoints. Is there something I'm
> missing with respect to schema generation including this prefix?
>
--
You received this message because you are subscribed to the Google Groups
"Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-rest-framework/23af85f2-40f0-4f2f-8fcd-81b140e5b0ad%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.