Add serializer for the content models.
Write a serializer for each model in content.py.
Updated by semyers almost 6 years ago
This task should be considered complete when all serializers for a given models module are defined in a corresponding serializers module.
The serializers defined should expose fields "native" (defined directly on a model or in its superclasses) to the model being represented, including Generic Key/Value types (Config/Notes/Scratchpad). Relations to other models should be included where possible, but the available serializer base classes and fields may be insufficient, so only the "native" fields should be required.
This task is among several similar tasks to stub out serializers for our existing models. Please spread the work around so we gain more team-wide knowledge around these serializers. If you have any questions, ask me. Common issues and their resolutions will be added to the pulp 3.0 rest-api development guide.
Updated by bmbouter almost 6 years ago
I don't think we'll be porting code from the old serializers in Pulp 2, but if we do...
There is an error in the Pulp 2 content serializer where 'children' is 'hildren'. Here is a snipped from the e-mail chain. I'm not filing a bug on this because we can't change it due to backwards compatibility and it won't be an issue in Pulp 3.
The "hildren" key appears on responses due to this logic in server/pulp/server/webservices/views/serializers/content.py content_unit_child_link_objs method: # look for children fields if not key.endswith('children'): continue child_keys.append(key) # child field key format: _<child type>_children child_type = key.rsplit('_', 1)[1:] # ... <pre>