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

msgpack renderer behaves too differently from the builtin json renderer #8

Open
gjcarneiro opened this issue Jun 29, 2016 · 2 comments

Comments

@gjcarneiro
Copy link

This project encodes Decimal like this:

        elif isinstance(obj, decimal.Decimal):
            return {'__class__': 'decimal', 'as_str': str(obj)}

While DRF json renderer encodes Decimal like this:

        elif isinstance(obj, decimal.Decimal):
            # Serializers will coerce decimals to strings by default.
            return float(obj)

I think it is a terrible idea that they behave so differently, since it means you cannot easily switch from json to msgpack. I just tried to change, and it completely breaks my client.

@juanriaza
Copy link
Owner

@gjcarneiro thanks for checking this annoyance. I'm looking into this as soon as I find some spare time.

@juanriaza
Copy link
Owner

juanriaza commented Apr 22, 2017

@gjcarneiro looks like it was that way at the point that the library was created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants