Skip to content
This repository has been archived by the owner on Jan 11, 2021. It is now read-only.

Add support for making API paths relative to the specified api_path setting #433

Merged
merged 2 commits into from
May 3, 2016
Merged

Add support for making API paths relative to the specified api_path setting #433

merged 2 commits into from
May 3, 2016

Conversation

MrTam
Copy link

@MrTam MrTam commented Apr 21, 2016

I ran into an issue with DRS, when coupled with the excellent swagger-codegen project.

My URI scheme prefixes the API, in the format of /api/v1/foo. Generated URIs retrieved from the DRF routers fully qualify ViewSets with this prefix.

With the api_path set to default (/), full paths appear in the generated docs. This means that swagger-codegen parses the name incorrectly, as it always expects resources to be relative to their base path.

Also, if i do set the api_path to be /api/v1/foo, generated client libraries try to access the resource at /api/v1/foo/api/v1/foo/resource. I think this behaviour is incorrect, as the APIs are supposed to be relative to the resource basePath.

This PR adds support for this functionality. With the new relative_paths setting set to True, URIs shall be relative to the api_path setting. Default value is False, to preserve existing behaviour.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants