Project

Profile

Help

Issue #4394

Content serializer validate should ensure a saveable object

Added by mdellweg 8 months ago. Updated 6 months ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

This may be up for discussion:
In the current state, the content serializer family can validate content objects containing artifacts, but when valid, the user is supposed to pop off the `_artifact{,s}` field and create the `ContentArtifact` entities on his own.
I think, if the serializer said, an object is valid, a subsequent `save` without further parameters should just work.

In my approach, i tried to follow the example in [0]. This has the nice side-effect, that the plugin writer is not anymore concerned with handling the `ContentArtifacts` at all.

[0] https://www.django-rest-framework.org/api-guide/serializers/#writing-create-methods-for-nested-representations


Related issues

Related to RPM Support - Issue #4472: Relative_path error when uploading a file MODIFIED Actions

History

#1 Updated by amacdona@redhat.com 8 months ago

  • Status changed from NEW to POST
  • Assignee set to mdellweg

#2 Updated by CodeHeeler 8 months ago

  • Triaged changed from No to Yes

#3 Updated by daviddavis 8 months ago

  • Tags Pulp 3, Pulp 3 RC Blocker added

#4 Updated by daviddavis 8 months ago

  • Status changed from POST to MODIFIED

Solution was to move content artifact creation into the create method of serializers. There's a relative_path field now on SingleArtifactContentSerializer which plugins can set in the validate method. See pulp_file as an example:

https://github.com/pulp/pulp_file/pull/166

#5 Updated by daviddavis 8 months ago

  • Related to Issue #4472: Relative_path error when uploading a file added

#6 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#7 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