-
Notifications
You must be signed in to change notification settings - Fork 150
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
Remove Cornice default json renderer? #470
Comments
To be honest, I can't recall much about that. If we can, I would really be in favor of removing anything specific we have in the code base. This one caught my attention for example: cornice/tests/test_validation.py Lines 121 to 122 in 31bbdb9
If you investigate about this, please share your findings ;) |
Thanks @leplatrem Sounds like a plan - I'll comment here whatever I find out. The code you cited seems interesting as it's not using the official internet media type 'application/json' (https://www.iana.org/assignments/media-types/media-types.xhtml#text) ... I also wonder what might break if we change that. Thanks! |
Also, I wouldn't mind releasing a new major version with a breaking change about that :) |
Sorry for the loooooong delay @leplatrem Turned out that we didn't have to touch Cornice's JSON renderer at all. Instead, serializing our domain objects to a In our case, we added a Postgres JSON(B) column to our domain objects and such when read from DB by SQLAlchemy is just a vanilla It would be ideal to understand if the existence of the custom Cornice's JSON renderer is truly needed. But, further investigation would be required. For our practical purposes, the custom Cornice's JSON renderer was irrelevant in our case so this issue doesn't apply to us anymore (and may be closed). I did though remove all instances of There were few changes related to #113 that @msabramo identified back when. |
In my opinion, less code is better. We should get rid of it :)
|
Hey @leplatrem I found this which is renderer related. It's easily fixable now removing the content-type overriding logic of Cornice. I'm hesitant to do it though, cause I don't know why that logic was there in the first place, and I think it would be a breaking change. What do you think it's best to do? |
Now that we have this overriding logics I think that this is less urgent. We could add a deprecation warning, and remove it in the future when we release another major version with breaking changes. The current master has enough I believe |
Hi folks,
I came across this pyramid feature that allows to serialize anything into JSON but also found this cornice PR comment that says it's not fully functional.
What's the current state of affairs of a custom/overloaded renderer?
Ideally, one could bypass the colander serializer and pyramid renderer all together, even return the JSON string straight from PostgreSQL JSONB column, perhaps?
cornice/cornice/util.py
Lines 51 to 71 in 66ce29f
The text was updated successfully, but these errors were encountered: