Project

Profile

Help

Story #5927

As a plugin writer, I have docs recommending I use Serializers to validate any model data

Added by daviddavis 10 months ago. Updated about 1 month ago.

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

100%

Estimated time:
Platform Release:
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Documentation
Sprint:
Sprint 81
Quarter:

Description

In a discussion on pulp-dev we decided that models shouldn't validate data (but rather serializers should).

We should add a section to the plugin writers guide here called "Validating Models" which makes these recommendations.


Related issues

Blocks Pulp - Task #5828: Document how to validate data in plugin writer guideNEW

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

Associated revisions

Revision 1ccbdfe4 View on GitHub
Added by mdellweg about 2 months ago

Add documentation for validating models

fixes #5927 https://pulp.plan.io/issues/5927

History

#1 Updated by daviddavis 10 months ago

  • Description updated (diff)

#2 Updated by bmbouter 10 months ago

  • Groomed changed from No to Yes
  • Sprint Candidate changed from No to Yes

#3 Updated by rchan 10 months ago

  • Sprint set to Sprint 64

#4 Updated by fao89 9 months ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to fao89

#5 Updated by fao89 9 months ago

I have an implementation, but I made so many workarounds:
https://github.com/pulp/pulpcore/pull/514

1 - I adapted PulpPluginAppConfig for getting the serializers (2 serializers with the same model, results in dict with only the last serializer)
2 - Convert model to dict for using it on serializer
2.1 - serializers with nested serializers like DistributionTreeSerializer: https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/serializers.py#L1020
I'm sending an empty list on the related fields like: "addons": [], "checksums": [], ...
2.2 - SingleArtifactContentUploadSerializer needs relative_path, artifact / file, I'm sending a fake file,
but when validation requires a specific kind of file it fails. I got it here: https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/serializers.py#L232-L246
which I treated by avoiding deferred_validate
but I also got a problem here:
https://github.com/pulp/pulp_rpm/blob/master/pulp_rpm/app/serializers.py#L500-L513
that I could not treat

#6 Updated by rchan 9 months ago

  • Sprint changed from Sprint 64 to Sprint 65

#7 Updated by fao89 9 months ago

  • Status changed from ASSIGNED to POST

#8 Updated by fao89 9 months ago

  • Status changed from POST to NEW
  • Assignee deleted (fao89)

#9 Updated by rchan 9 months ago

  • Sprint changed from Sprint 65 to Sprint 66

#10 Updated by fao89 9 months ago

  • Description updated (diff)
  • Status changed from NEW to ASSIGNED
  • Assignee set to fao89

#11 Updated by fao89 9 months ago

  • Status changed from ASSIGNED to POST

#12 Updated by daviddavis 9 months ago

  • Sprint/Milestone changed from 3.1.0 to 3.2.0

#13 Updated by rchan 8 months ago

  • Sprint changed from Sprint 66 to Sprint 67

#14 Updated by daviddavis 8 months ago

  • Sprint/Milestone changed from 3.2.0 to 3.3.0

#15 Updated by rchan 8 months ago

  • Sprint changed from Sprint 67 to Sprint 68

#16 Updated by fao89 7 months ago

  • Blocks Task #5828: Document how to validate data in plugin writer guide added

#17 Updated by rchan 7 months ago

  • Sprint deleted (Sprint 68)

#18 Updated by daviddavis 7 months ago

  • Sprint/Milestone deleted (3.3.0)

#20 Updated by bmbouter 6 months ago

  • Status changed from POST to NEW

Bringing back to new before I rewrite the issue to be only a docs change.

#21 Updated by fao89 6 months ago

  • Assignee deleted (fao89)

#22 Updated by bmbouter 6 months ago

  • Subject changed from As a plugin writer, I can validate Content data in the Stages API to As a plugin writer, I have docs recommending I use Serializers to validate any model data
  • Description updated (diff)
  • Tags Documentation added

#23 Updated by rchan 5 months ago

  • Sprint set to Sprint 74

#24 Updated by rchan 5 months ago

  • Sprint changed from Sprint 74 to Sprint 75

#25 Updated by rchan 4 months ago

  • Sprint changed from Sprint 75 to Sprint 76

#26 Updated by rchan 4 months ago

  • Sprint changed from Sprint 76 to Sprint 77

#27 Updated by rchan 3 months ago

  • Sprint changed from Sprint 77 to Sprint 78

#28 Updated by rchan 3 months ago

  • Sprint changed from Sprint 78 to Sprint 79

#29 Updated by mdellweg 2 months ago

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

#30 Updated by pulpbot 2 months ago

  • Status changed from ASSIGNED to POST

#31 Updated by rchan 2 months ago

  • Sprint changed from Sprint 79 to Sprint 80

#32 Updated by rchan 2 months ago

  • Sprint changed from Sprint 80 to Sprint 81

#33 Updated by mdellweg about 2 months ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100

#34 Updated by bmbouter about 1 month ago

  • Sprint/Milestone set to 3.7.0

#35 Updated by pulpbot about 1 month ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Please register to edit this issue

Also available in: Atom PDF