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
Provide a way to customize, per content type, the ISerializeToJsonSummary for IContentListingObject #338
Comments
|
Hey, we're running into the same issue. The default serializer returns almost enough data when we request a folder containing a bunch of instances of a certain content type. If we could overwrite the serializer to include a tiny bit more data it would save us from having to make many extra http requests to get the details of each instance of the content type. Does anyone know if a solution for this was ever implemented? |
Serializers are adapters and are defined here: If you need to serialize some other attributes, you need to write your own adapter and register it for your Interface of choice: https://github.com/plone/plone.restapi/blob/master/src/plone/restapi/serializer/configure.zcml#L16 |
@eral the problem is that that adapter is not taking the brain item into consideration, AFAIK. We want per brain customization |
OK then, per brain customization can't be achieved through this kind of adapters. |
Would it be sufficient to make the summary serializer leave out keys whose value in the catalog brain is Missing.Value, instead of serializing it as |
In
SerializeCollectionToJson
implementation for the collections, theresult['items']
areISerializeToJsonSummary
ofIContentListingObject
.Let's say I want to customize how the brains are serialized, but only some of them, for example, for the images, I want to add a "thumb" property. I would like it if the collection serialization code would do something like:
instead of the existing
This would allow providing a custom json summary serializer, per different content type.
The text was updated successfully, but these errors were encountered: