-
Notifications
You must be signed in to change notification settings - Fork 13
Description
Currently when serializing with fields.Nested, we always serialize the whole object and add @type information.
In some cases, we want to instead serialize an @id reference instead of the whole nested object.
Theoretically this would be possible with something like fields.Nested(schema.address, AddressSchema, only=("_id",)), but that will result in something like {"@id": "...", "@type": "..."}, whereas for an id reference we wouldn't want to have the @type information included.
We could add an addition flag to fields.Nested to skip adding the @type but that's probably not a clean solution.
A new field like fields.IdReference(schema.address, AddressSchema) would make sense that still takes the child schema like fields.Nested but only returns the @id of the child. On deserializing, it should look up the @id to see if it can get that object in the data and if not, raise an exception.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status