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 almost 6 years ago. Updated about 5 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
Actions #1

Updated by bmbouter almost 6 years ago

+1 this looks like exactly what we talked about. Thanks so much for writing this up.

Actions #3

Updated by dalley almost 6 years ago

  • Is duplicate of Task #4282: Rename 'artifact' to '_artifact' added

Added by dalley almost 6 years ago

Revision 8c793f8a | View on GitHub

Add custom serializers for "_artifact" vs "_artifacts"

Remove boilerplate from the plugins by defining new, more specialized serializers for the single-artifact-per-content case, the multiple-artifacts-per-content case, and the no-artifacts-per-content case.

Required PR: https://github.com/pulp/pulp_file/pull/159 Required PR: https://github.com/PulpQE/pulp-smash/pull/1164 Required PR: https://github.com/pulp/pulpcore-plugin/pull/38

re: #4366 https://pulp.plan.io/issues/4366

Added by dalley almost 6 years ago

Revision 8c793f8a | View on GitHub

Add custom serializers for "_artifact" vs "_artifacts"

Remove boilerplate from the plugins by defining new, more specialized serializers for the single-artifact-per-content case, the multiple-artifacts-per-content case, and the no-artifacts-per-content case.

Required PR: https://github.com/pulp/pulp_file/pull/159 Required PR: https://github.com/PulpQE/pulp-smash/pull/1164 Required PR: https://github.com/pulp/pulpcore-plugin/pull/38

re: #4366 https://pulp.plan.io/issues/4366

Actions #6

Updated by dalley almost 6 years ago

  • Status changed from ASSIGNED to POST
Actions #7

Updated by dalley almost 6 years ago

Added by dalley almost 6 years ago

Revision 4376e5c8 | View on GitHub

Update to use specialized serializers

re: #4366 https://pulp.plan.io/issues/4366

Actions #11

Updated by dalley almost 6 years ago

  • Status changed from POST to MODIFIED
Actions #12

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #13

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3, Pulp 3 RC Blocker)
Actions #14

Updated by bmbouter about 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF