-
Notifications
You must be signed in to change notification settings - Fork 457
New issue
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
OpenAPI auth credentials reverse order #679
Comments
HI i didnot understand please where am i go to changes for this issue |
This is not issue. If you use djoser's universal serializer: The reason of such behaviour is that If you use own serializer: Rewrite order on your side. If you use djosers serializer, but want to change rendering in spectacular, you can create custom serializer, without logic, just with fields definition, and use spectacular extend_schema for overwrite. |
It's been quite some time, since I had this UX (imo) issue. So, if I understand it correctly, what you suggest is the following: # serializers.py
class CustomAuthSerializer(serializers.Serializer):
username = serializers.CharField(min_length=3, max_length=20)
password = serializers.CharField(min_length=8, max_length=50, write_only=True) # views.py
# override the default login api view, post method to add the following
@extend_schema(description="Authentication token retrieval endpoint.", request=[CustomAuthSerializer]) |
@Gr3at Yes, something like this. i will not help on concrete |
This is not a bug, rather a common logic (expected representation convention).
The generated OpenAPI specification schema, presents
username
andpassword
fields in reverse (as someone would expect it) order (screenshot attached).I am user drf spectacular to generate the openapi schema.
This might be my faulty configuration, but looking into an old related issue, the order seems to also be
password
before theusername
.The text was updated successfully, but these errors were encountered: