Comments (6)
Should this maybe be a two-way solution so that we can prepare data for updating / creating?
from plone.restapi.
Please note that the schema serialization was just a proof-of-concept. That was never meant to be the final code.
Your questions:
- Not that I would know.
- Could go into plone.restapi first, could be refactored into a separate package as well.
- Looks ok to me. Adapters always work. ;)
from plone.restapi.
Ok, thanks. I'll make a PR 😉
from plone.restapi.
Looks good to me :)
Is there already some serialization mechanism which produces JSON-compatible output (!) for dexterity?
I wouldn't know of one that does exactly this, but:
plone.supermodel
provides XML import and export for schema interfaces based onzope.schema
fieldsplone.rfc822
does marshalling of content objects described byzope.schema
fields from and to RFC (2)822 messages (E-Mail / HTTP-Messages).
So even though they do something different, it still could be worth a look for some tricky cases, maybe we can pick up some odd bits and pieces from these packages.
from plone.restapi.
I think the IFieldSerializer
adapter and your choice of discriminators is the way to go, but at some later stage we might need another layer of abstraction:
We'll have use cases where we'll want to serialize objects that aren't Plone content types (think SQL backed content for example). When using SQLAlchemy the Column
objects could play a similar role to fields, in that the describe the data type, but I could imagine cases where you don't even have a field to adapt - you just know you're dealing with a datetime, and you want to be able to re-use the conversion to a JSON-compatible ISO format instead of writing it yourself.
So maybe at some later stage, we'd need some concept like plain Converter
s, where a DateTimeFieldSerializer
would delegate to a DateTimeConverter
instead of doing the conversion itself.
from plone.restapi.
I've got two suggestions of cosmetic nature:
IFieldSerializer
should adapt the field first as it is the main thing that is adapted:
def __init__(self, field, context, request)
- Do serialization in the
__call__()
method instead of aserialize()
method. This reduces verbosity in codeserializer.serialize()
vs.serializer()
I've started implementing deserialization in #41 following this approach.
from plone.restapi.
Related Issues (20)
- relatedItems field returns None in the serializer if the related item is deleted HOT 1
- Site Administrator cannot add user to group
- Add remote_url(getRemoteUrl) to link content-types in navigation HOT 4
- Include release notes in Plone 6 Documentation
- Authentication error messages from PAS Plugins aren't returned by the restapi HOT 1
- restapi double parameter is broking code. HOT 8
- In content that uses the plone.blocks behavior, it is not possible to add fields to SearchableText with "plone.app.dexterity.textindexer" HOT 6
- Community Forum App Icon Not Filling Correctly. HOT 1
- Add plone.app.discussion control panel
- Types control panel does not allow to enable/disable discussion for a content type
- Implement SummaryDiscussionListingTemplate to fix Discussion url in listings HOT 1
- Documentation of event content type does not return a timezone
- NoneType' object has no attribute 'getProperty': when searching users HOT 1
- @querystring shouldn't list userids
- Test with Plone 6.1 HOT 1
- Require plone.app.iterate on test extras
- Require plone.app.upgrade in test extras
- @aliases endpoint should allow to filter by how an alias has been added (automatically, manually)
- @aliases endpoint should support filtering by date (from, to) HOT 3
- @aliases endpoint should allow to upload/download all aliases and allow to download filtered aliases as CSV file
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from plone.restapi.