Project

Profile

Help

Story #4366

closed

As a plugin writer, I have special purpose Content Serializers for content types that have 0, 1, or many artifacts per content

Added by dalley about 5 years ago. Updated over 4 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
% Done:

0%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
No
Tags:
Sprint:
Sprint 48
Quarter:

Description

The "_artifacts" field is rather difficult to use from a user perspective, and is also over-generalized. Nearly all currently existing Pulp 3 plugins have a single have a single artifact per content unit, and carry around boilerplate code to replace the "_artifacts" (plural) serializer field with a singular version, in order to avoid the usability issues that comes with it.

This boilerplate is not ideal, and errors found in it (such as [0] )must be made against many, many plugins.

There are also additional common invariants, such as Content without any Artifacts, which should be handled in a more explicit way without any plugin writer boilerplate.

To fix this, we propose the following changes to the plugin API:

  • The current "ContentSerializer" will be renamed to MultiArtifactContentSerializer
  • A new "SingleArtifactContentSerializer" will be defined, which has an "_artifact" field, which lists a single artifact
  • A new "NoArtifactContentSerializer" will be defined, which lacks any field related to Artifacts

Plugin writers will inherit their own content serializers from the one most closely matching their needs.

The one used in plugin_template by default will be the SingleArtifactContentSerializer, with a FIXME instruction added.

This should also be documented in the plugin writer docs.

[0] https://pulp.plan.io/issues/4340


Related issues

Is duplicate of File Support - Task #4282: Rename 'artifact' to '_artifact'CLOSED - DUPLICATEppicka

Actions

Also available in: Atom PDF