Project

Profile

Help

Story #2984

closed

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

Added by daviddavis over 7 years ago. Updated about 5 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:
Sprint:
Sprint 27
Quarter:

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

Related to Pulp - Issue #2976: 500 error when I try to create a username with more than 150 charsCLOSED - DUPLICATEActions
Has duplicate Pulp - Issue #2975: Username field doesn't validate charactersCLOSED - DUPLICATEActions
Has duplicate Pulp - Issue #2974: Error when attempting to create two repos with the same nameCLOSED - DUPLICATEActions
Actions #1

Updated by daviddavis over 7 years ago

  • Has duplicate Issue #2975: Username field doesn't validate characters added
Actions #2

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
Actions #3

Updated by daviddavis over 7 years ago

  • Has duplicate Issue #2974: Error when attempting to create two repos with the same name added
Actions #4

Updated by daviddavis over 7 years ago

  • Tags Pulp 3 added
Actions #5

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.

Actions #6

Updated by mhrivnak over 7 years ago

  • Sprint/Milestone set to 45
Actions #7

Updated by bizhang about 7 years ago

  • Status changed from NEW to ASSIGNED
  • Assignee set to bizhang
Actions #8

Updated by jortel@redhat.com about 7 years ago

  • Sprint/Milestone changed from 45 to 46
Actions #9

Updated by bizhang about 7 years ago

  • Status changed from ASSIGNED to POST

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

closes #2984 https://pulp.plan.io/issues/2984

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

closes #2984 https://pulp.plan.io/issues/2984

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

Actions #10

Updated by werwty about 7 years ago

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

Updated by bmbouter almost 7 years ago

  • Sprint set to Sprint 27
Actions #13

Updated by bmbouter almost 7 years ago

  • Sprint/Milestone deleted (46)
Actions #14

Updated by daviddavis over 5 years ago

  • Sprint/Milestone set to 3.0.0
Actions #15

Updated by bmbouter over 5 years ago

  • Tags deleted (Pulp 3)
Actions #16

Updated by bmbouter about 5 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF