Hard coded domain/url in get_paginated_response_schema #7817
Unanswered
SteinRobert
asked this question in
Ideas & Suggestions
Replies: 2 comments 1 reply
-
I was just having a closer look at the design of the schema generation within DRF. May the following suggestion is more appropriate.
This way schema generation is still isolated within the |
Beta Was this translation helpful? Give feedback.
1 reply
-
I rebased the PR (#7657) onto the current |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Checklist
master
branch of Django REST framework.I noticed that the domain and url within the schema of a response is hard coded (https://github.com/encode/django-rest-framework/blob/master/rest_framework/pagination.py#L240).
I was thinking about making the example string somehow configurable. Not sure how though. Maybe a Django setting?
However, this may not be flexible enough when applying a pagination class to different viewsets.
So maybe we could expand the views by some parameters? Or even getter methods.
It could be passed into
get_paginated_response_schema
when called (https://github.com/encode/django-rest-framework/blob/master/rest_framework/schemas/openapi.py#L665):This way the domain and the url would be configurable. We could still fallback to the default.
Any thoughts?
Steps to reproduce
Generate a schema with a list view.
Expected behavior
The response should look like this:
Actual behavior
The response looks somehow like the following:
Beta Was this translation helpful? Give feedback.
All reactions