We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'd like to be able to nest serializers within the response documentation under string keys.
In my api, all of our responses are nested under a "data" key like so:
"data"
{ "data": { "first_name": "Foo", "email": "test@example.com" }, "message": "User account successfully created!" }
To achieve this response the routes return responses that look something like this...
return Response( ResponseSerializer( dict( data=UserSerializer(user).data, message="User account successfully created!", ) ).data, status=status.HTTP_200_OK, )
I'd like to be able to do this:
USER_RESPONSES = { 200: { "data": UserSerializer(), "message": "User account successfully created!" } }
However that doesn't work, so I'm forced to manually write out all the attributes within the UserSerializer again within the documentation.
UserSerializer
Are there any workarounds? I've investigated, but I haven't been able to find any good options for how to achieve this behaviour.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Feature Request
I'd like to be able to nest serializers within the response documentation under string keys.
Description
In my api, all of our responses are nested under a
"data"
key like so:To achieve this response the routes return responses that look something like this...
Describe the solution you'd like
I'd like to be able to do this:
However that doesn't work, so I'm forced to manually write out all the attributes within the
UserSerializer
again within the documentation.Describe alternatives you've considered
Are there any workarounds? I've investigated, but I haven't been able to find any good options for how to achieve this behaviour.
The text was updated successfully, but these errors were encountered: