Project

Profile

Help

Story #4366

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 over 1 year ago. Updated 7 months 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

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


Checklist


Related issues

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

<a title="Actions" class="icon-only icon-actions js-contextmenu" href="#">Actions</a>

Associated revisions

Revision 8c793f8a View on GitHub
Added by dalley over 1 year ago

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

Revision 8c793f8a View on GitHub
Added by dalley over 1 year ago

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

Revision 4376e5c8 View on GitHub
Added by dalley over 1 year ago

Update to use specialized serializers

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

History

#1 Updated by bmbouter over 1 year ago

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

#2 Updated by dalley over 1 year ago

  • Checklist item Add support to pulpcore added
  • Checklist item Fix pulp_file added
  • Checklist item Fix plugin_template added
  • Checklist item Fix pulp_rpm added
  • Checklist item Fix pulp_python added
  • Checklist item Fix pulp_docker added
  • Checklist item Fix pulp_ansible added

#3 Updated by dalley over 1 year ago

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

#5 Updated by amacdona@redhat.com over 1 year ago

  • Checklist item Update plugin writer's guide added

#6 Updated by dalley over 1 year ago

  • Checklist item Fix pulpcore-plugin added
  • Checklist item Fix pulp-smash added
  • Checklist item Add support to pulpcore set to Done
  • Checklist item Fix pulp_file set to Done
  • Status changed from ASSIGNED to POST

#7 Updated by dalley over 1 year ago

  • Checklist item Fix plugin_template set to Done

#8 Updated by dalley over 1 year ago

  • Checklist item Update plugin writer's guide set to Done

#9 Updated by dalley over 1 year ago

  • Checklist item Fix pulp_rpm set to Done

#10 Updated by dalley over 1 year ago

  • Checklist item Fix pulp_python set to Done

#11 Updated by dalley over 1 year ago

  • Checklist item Fix pulp_docker set to Done
  • Checklist item Fix pulp_ansible set to Done
  • Status changed from POST to MODIFIED

#12 Updated by daviddavis about 1 year ago

  • Sprint/Milestone set to 3.0.0

#13 Updated by bmbouter about 1 year ago

  • Tags deleted (Pulp 3, Pulp 3 RC Blocker)

#14 Updated by bmbouter 7 months ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF