Project

Profile

Help

Story #5927

closed

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

Added by daviddavis almost 5 years ago. Updated about 4 years 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 guideCLOSED - DUPLICATE

Actions
Actions #1

Updated by daviddavis almost 5 years ago

  • Description updated (diff)
Actions #2

Updated by bmbouter almost 5 years ago

  • Groomed changed from No to Yes
  • Sprint Candidate changed from No to Yes
Actions #3

Updated by rchan almost 5 years ago

  • Sprint set to Sprint 64
Actions #4

Updated by fao89 almost 5 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to fao89
Actions #5

Updated by fao89 almost 5 years 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

Actions #6

Updated by rchan almost 5 years ago

  • Sprint changed from Sprint 64 to Sprint 65
Actions #7

Updated by fao89 almost 5 years ago

  • Status changed from ASSIGNED to POST
Actions #8

Updated by fao89 almost 5 years ago

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

Updated by rchan almost 5 years ago

  • Sprint changed from Sprint 65 to Sprint 66
Actions #10

Updated by fao89 almost 5 years ago

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

Updated by fao89 almost 5 years ago

  • Status changed from ASSIGNED to POST
Actions #12

Updated by daviddavis almost 5 years ago

  • Sprint/Milestone changed from 3.1.0 to 3.2.0
Actions #13

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 66 to Sprint 67
Actions #14

Updated by daviddavis over 4 years ago

  • Sprint/Milestone changed from 3.2.0 to 3.3.0
Actions #15

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 67 to Sprint 68
Actions #16

Updated by fao89 over 4 years ago

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

Updated by rchan over 4 years ago

  • Sprint deleted (Sprint 68)
Actions #18

Updated by daviddavis over 4 years ago

  • Sprint/Milestone deleted (3.3.0)
Actions #20

Updated by bmbouter over 4 years ago

  • Status changed from POST to NEW

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

Actions #21

Updated by fao89 over 4 years ago

  • Assignee deleted (fao89)
Actions #22

Updated by bmbouter over 4 years 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
Actions #23

Updated by rchan over 4 years ago

  • Sprint set to Sprint 74
Actions #24

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 74 to Sprint 75
Actions #25

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 75 to Sprint 76
Actions #26

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 76 to Sprint 77
Actions #27

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 77 to Sprint 78
Actions #28

Updated by rchan over 4 years ago

  • Sprint changed from Sprint 78 to Sprint 79
Actions #29

Updated by mdellweg over 4 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to mdellweg
Actions #30

Updated by pulpbot over 4 years ago

  • Status changed from ASSIGNED to POST
Actions #31

Updated by rchan about 4 years ago

  • Sprint changed from Sprint 79 to Sprint 80
Actions #32

Updated by rchan about 4 years ago

  • Sprint changed from Sprint 80 to Sprint 81

Added by mdellweg about 4 years ago

Revision 1ccbdfe4 | View on GitHub

Add documentation for validating models

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

Actions #33

Updated by mdellweg about 4 years ago

  • Status changed from POST to MODIFIED
  • % Done changed from 0 to 100
Actions #34

Updated by bmbouter about 4 years ago

  • Sprint/Milestone set to 3.7.0
Actions #35

Updated by pulpbot about 4 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF