Skip to content
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

yaml.representer.RepresenterError: ('cannot represent an object', Decimal('100')) #316

Closed
idesoto-rover opened this issue Feb 26, 2021 · 1 comment
Labels
bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@idesoto-rover
Copy link

Describe the bug
When running the spectacular command to generate a schema in version 0.13.2 I get the following error:

yaml.representer.RepresenterError: ('cannot represent an object', Decimal('100'))

To Reproduce
Add the following field to any serializer.

    value = serializers.DecimalField(
        decimal_places=2,
        min_value=Decimal(1),
        max_value=Decimal(100),
        max_digits=5
    )

The problem is using Decimal for min_value and max_value. Changing those to just integers (1 and 100) solves the issue, but I think using Decimals should be supported too.

Expected behavior
The schema should be generated successfully.

@tfranzel tfranzel added the bug Something isn't working label Feb 26, 2021
tfranzel added a commit that referenced this issue Feb 26, 2021
@tfranzel tfranzel added the fix confirmation pending issue has been fixed and confirmation from issue reporter is pending label Feb 26, 2021
@tfranzel tfranzel closed this as completed Mar 9, 2021
@idesoto-rover
Copy link
Author

Btw, this fixed my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

2 participants