Project

Profile

Help

Story #2984

As an API user, I get user friendly feedback when I use an invalid value

Added by daviddavis@redhat.com 3 months ago. Updated about 1 month ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
% Done:

100%

Platform Release:
Blocks Release:
Backwards Incompatible:
No
Groomed:
Yes
Sprint Candidate:
Yes
Tags:
Pulp 3
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No

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.


Checklist


Related issues

Related to Pulp - Issue #2976: 500 error when I try to create a username with more than 150 chars CLOSED - DUPLICATE Actions
Duplicated by Pulp - Issue #2975: Username field doesn't validate characters CLOSED - DUPLICATE Actions
Duplicated by Pulp - Issue #2974: Error when attempting to create two repos with the same name CLOSED - DUPLICATE Actions

Associated revisions

Revision 36e840c7 View on GitHub
Added by werwty about 1 month ago

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

Revision 67ebef1e View on GitHub
Added by werwty about 1 month ago

Add validators for importer and publisher

re #2984

History

#1 Updated by daviddavis@redhat.com 3 months ago

  • Duplicated by Issue #2975: Username field doesn't validate characters added

#2 Updated by daviddavis@redhat.com 3 months ago

  • Related to Issue #2976: 500 error when I try to create a username with more than 150 chars added

#3 Updated by daviddavis@redhat.com 3 months ago

  • Duplicated by Issue #2974: Error when attempting to create two repos with the same name added

#4 Updated by daviddavis@redhat.com 3 months ago

  • Tags Pulp 3 added

#5 Updated by amacdona@redhat.com 2 months 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 2 months ago

  • Sprint/Milestone set to Sprint 26

#7 Updated by bizhang about 2 months ago

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

#8 Updated by jortel@redhat.com about 1 month ago

  • Sprint/Milestone changed from Sprint 26 to Sprint 27

#9 Updated by bizhang about 1 month ago

  • Status changed from ASSIGNED to POST

#10 Updated by werwty about 1 month ago

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

Please register to edit this issue

Also available in: Atom PDF