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 9 months ago. Updated 6 months ago.

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

0%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
Yes
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
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

Duplicates File Support - Task #4282: Rename 'artifact' to '_artifact' CLOSED - DUPLICATE Actions

Associated revisions

Revision 2edd845f View on GitHub
Added by dalley 9 months 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/pulp/pulp/pull/3846
Required PR: https://github.com/PulpQE/pulp-smash/pull/1164

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

Revision 8c793f8a View on GitHub
Added by dalley 9 months 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 9 months 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 3189b1f9 View on GitHub
Added by dalley 9 months ago

Update the plugin writer guide for serializer changes

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

Revision d503518d View on GitHub
Added by dalley 9 months ago

Use new specialized serializers

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

Revision 4376e5c8 View on GitHub
Added by dalley 9 months ago

Update to use specialized serializers

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

Revision 3b05da47 View on GitHub
Added by dalley 8 months ago

Use new specialized serializers

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

History

#1 Updated by bmbouter 9 months ago

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

#2 Updated by dalley 9 months 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 9 months ago

  • Duplicates Task #4282: Rename 'artifact' to '_artifact' added

#5 Updated by amacdona@redhat.com 9 months ago

  • Checklist item Update plugin writer's guide added

#6 Updated by dalley 9 months 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 9 months ago

  • Checklist item Fix plugin_template set to Done

#8 Updated by dalley 9 months ago

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

#9 Updated by dalley 9 months ago

  • Checklist item Fix pulp_rpm set to Done

#10 Updated by dalley 9 months ago

  • Checklist item Fix pulp_python set to Done

#11 Updated by dalley 9 months 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 6 months ago

  • Sprint/Milestone set to 3.0

#13 Updated by bmbouter 6 months ago

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

Please register to edit this issue

Also available in: Atom PDF