Hi,
Thank you for creating and maintaining drf-spectacular. It's an awesome tool.
It's great that it's typed and it uses type hints to figure out.
I recently started using it and am encountering a couple rough edges. I'm using redoc for displaying the API.
Viewsets
The default is to use the first path of the url as the tag. The first part of my endpoints is /api/.
I had trouble figuring out what the default was.
What I expected was that one ViewSet, i.e. get, list, put, patch, post and delete, would be grouped together.
The same applies to the summary that's used to display. That it would have standard text for each generic part of the viewsets.
The DRF router already assigns names to these.
ApiView decorated functions
These functions themselves are relatively straightforward most of the time.
It seems there is a disconnect between the ease of use as a programmer and how to generate the documentation for them.
I haven't found a good way to handle these cases and the documentation is spares on how to handle it.
A couple examples: Multiple views have logic with custom responses. That is, variants on: Response({"status": "invalid link" }, status=status.HTTP_400_BAD_REQUEST)
Specifying it with @schema results in: status: Encountered 2 components with identical names "status"
How to better handle these cases?
Another view returns important user data on login. To name a few: name, preferences, auth_groups, last_visted_page, company_name. I don't see good options for this view. extend_schema requires having the code twice, the same with creating a serializer. It would be alright to use a dataclass here, however, that needs to be wrapped inside a serializer to be picked up.
Is it possible to use a dataclass directly as the response?
Authorization
Is it possible to have permission classes show up in the schema?
Responses
How to show error responses for generic view sets? I.e. 400, BAD request, of 404 not found?
Hi,
Thank you for creating and maintaining drf-spectacular. It's an awesome tool.
It's great that it's typed and it uses type hints to figure out.
I recently started using it and am encountering a couple rough edges. I'm using redoc for displaying the API.
Viewsets
The default is to use the first path of the url as the tag. The first part of my endpoints is /api/.
I had trouble figuring out what the default was.
What I expected was that one ViewSet, i.e. get, list, put, patch, post and delete, would be grouped together.
The same applies to the summary that's used to display. That it would have standard text for each generic part of the viewsets.
The DRF router already assigns names to these.
ApiView decorated functions
These functions themselves are relatively straightforward most of the time.
It seems there is a disconnect between the ease of use as a programmer and how to generate the documentation for them.
I haven't found a good way to handle these cases and the documentation is spares on how to handle it.
A couple examples: Multiple views have logic with custom responses. That is, variants on:
Response({"status": "invalid link" }, status=status.HTTP_400_BAD_REQUEST)Specifying it with
@schemaresults in:status: Encountered 2 components with identical names "status"How to better handle these cases?
Another view returns important user data on login. To name a few: name, preferences, auth_groups, last_visted_page, company_name. I don't see good options for this view. extend_schema requires having the code twice, the same with creating a serializer. It would be alright to use a dataclass here, however, that needs to be wrapped inside a serializer to be picked up.
Is it possible to use a dataclass directly as the response?
Authorization
Is it possible to have permission classes show up in the schema?
Responses
How to show error responses for generic view sets? I.e. 400, BAD request, of 404 not found?