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
Hello!
It seems that a recent change in 753be1a made it so SerializerMethodField methods can no longer be annotated with typing.Optional.
typing.Optional
Used versions:
Example code:
class PetSerializer(serializers.ModelSerializer): human_age = serializers.SerializerMethodField() def get_human_age(self, obj) -> Optional[int]: if obj.human_age_multiplier is None: return None return math.floor(obj.age * obj.human_age_multiplier) class Meta: model = Pet
Expected result:
human_age: title: Human age type: integer readOnly: true x-nullable: true
Actual result:
human_age: title: Human age type: string readOnly: true
The text was updated successfully, but these errors were encountered:
Should be fixed by merged #428
Sorry, something went wrong.
No branches or pull requests
Hello!
It seems that a recent change in 753be1a made it so SerializerMethodField methods can no longer be annotated with
typing.Optional
.Used versions:
Example code:
Expected result:
Actual result:
The text was updated successfully, but these errors were encountered: