Story #2984
As an API user, I get user friendly feedback when I use an invalid value
100%
Description
There are several places in Pulp 3 where we ought to be using validation but are not. Here are a few examples with reproducers:
https://pulp.plan.io/issues/2974
https://pulp.plan.io/issues/2975
https://pulp.plan.io/issues/2976
There may be more issues too. Instead of opening individual bugs/tasks, this story is go through the API and add validation for any existing fields that need it.
Related issues
Associated revisions
Revision 36e840c7
View on GitHub
Add uniquenessand length validators to serializer fields.
Move username regex validator from model to serializer, since the model validation does not run automatically on model save: https://docs.djangoproject.com/en/dev/ref/validators/#how-validators-are-run
Note: For the importer and publisher uniqueness validator to take effect they must be declared on the Plugin importer and publisher class like so:
Class PluginPublisherSerializer(pulpcore.plugin.serializers.PublisherSerializer): class Meta: validators = PublisherSerializer.Meta.validators
Revision 67ebef1e
View on GitHub
Add validators for importer and publisher
re #2984
Revision 67ebef1e
View on GitHub
Add validators for importer and publisher
re #2984
History
#1
Updated by daviddavis over 3 years ago
- Has duplicate Issue #2975: Username field doesn't validate characters added
#2
Updated by daviddavis over 3 years ago
- Related to Issue #2976: 500 error when I try to create a username with more than 150 chars added
#3
Updated by daviddavis over 3 years ago
- Has duplicate Issue #2974: Error when attempting to create two repos with the same name added
#4
Updated by daviddavis over 3 years ago
- Tags Pulp 3 added
#5
Updated by amacdona@redhat.com over 3 years ago
- Groomed changed from No to Yes
- Sprint Candidate changed from No to Yes
I am seeing a 500 for duplicates across the board. The serializers do not check for uniqueness and the db error bubbles up.
#6
Updated by mhrivnak over 3 years ago
- Sprint/Milestone set to 45
#7
Updated by bizhang over 3 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to bizhang
#8
Updated by jortel@redhat.com over 3 years ago
- Sprint/Milestone changed from 45 to 46
#9
Updated by bizhang over 3 years ago
- Status changed from ASSIGNED to POST
#10
Updated by werwty over 3 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|36e840c7840851736f201b05bb6796a096d1a80e.
#12
Updated by bmbouter almost 3 years ago
- Sprint set to Sprint 27
#13
Updated by bmbouter almost 3 years ago
- Sprint/Milestone deleted (
46)
#14
Updated by daviddavis almost 2 years ago
- Sprint/Milestone set to 3.0.0
#15
Updated by bmbouter almost 2 years ago
- Tags deleted (
Pulp 3)
#16
Updated by bmbouter about 1 year ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Please register to edit this issue
Add uniquenessand length validators to serializer fields.
Move username regex validator from model to serializer, since the model validation does not run automatically on model save: https://docs.djangoproject.com/en/dev/ref/validators/#how-validators-are-run
Note: For the importer and publisher uniqueness validator to take effect they must be declared on the Plugin importer and publisher class like so:
Class PluginPublisherSerializer(pulpcore.plugin.serializers.PublisherSerializer): class Meta: validators = PublisherSerializer.Meta.validators
closes #2984 https://pulp.plan.io/issues/2984