Story #2984
closedAs 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
Updated by daviddavis over 7 years ago
- Has duplicate Issue #2975: Username field doesn't validate characters added
Updated by daviddavis over 7 years ago
- Related to Issue #2976: 500 error when I try to create a username with more than 150 chars added
Updated by daviddavis over 7 years ago
- Has duplicate Issue #2974: Error when attempting to create two repos with the same name added
Updated by amacdona@redhat.com over 7 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.
Updated by bizhang about 7 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to bizhang
Updated by jortel@redhat.com about 7 years ago
- Sprint/Milestone changed from 45 to 46
Updated by bizhang about 7 years ago
- Status changed from ASSIGNED to POST
Added by werwty about 7 years ago
Added by werwty about 7 years ago
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
Added by werwty about 7 years ago
Revision 67ebef1e | View on GitHub
Add validators for importer and publisher
re #2984
Added by werwty about 7 years ago
Revision 67ebef1e | View on GitHub
Add validators for importer and publisher
re #2984
Updated by werwty about 7 years ago
- Status changed from POST to MODIFIED
- % Done changed from 0 to 100
Applied in changeset pulp|36e840c7840851736f201b05bb6796a096d1a80e.
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
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