-
Notifications
You must be signed in to change notification settings - Fork 321
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
Fix LoginView and RegisterView response schema generation #283
base: master
Are you sure you want to change the base?
Conversation
c9fe22b
to
900eb07
Compare
super().__init__(*args, **kwargs) | ||
|
||
|
||
class DynamicFieldSerializerMetaclass(serializers.SerializerMetaclass): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add tests
@@ -189,30 +191,46 @@ class Meta: | |||
read_only_fields = ('email',) | |||
|
|||
|
|||
class JWTSerializer(serializers.Serializer): | |||
class DynamicSerializerField(Field): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add tests
|
||
user_data = JWTUserDetailsSerializer(obj['user'], context=self.context).data | ||
return user_data | ||
user = DynamicSerializerField( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: Add tests
900eb07
to
7284db1
Compare
Hello! Due to use of
serializers.SerializerMethodField()
the generated OpenAPI schema wasn't previously accurate.The schema will vary based on some project settings values, but with the default values the
/login/
endpoint previously looked like:(Which of course isn't the correct response payload)
And now looks like: