Project

Profile

Help

Issue #3755

allow_blank is not set to true for optional fields

Added by bizhang over 1 year ago. Updated 6 months ago.

Status:
MODIFIED
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Severity:
2. Medium
Version:
Platform Release:
Blocks Release:
OS:
Backwards Incompatible:
No
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix
QA Contact:
Complexity:
Smash Test:
Verified:
No
Verification Required:
No
Sprint:

Description

By default allow_blank is set to False:
http://www.django-rest-framework.org/api-guide/fields/#charfield

Optional fields that do not have this set to True have a minlength field in the schema:


description: {
title: "Description",
description: "An optional description.",
type: "string",
minLength: 1
},

So when the field is not being sent in a request, the request fails validation.
Every CharField that does not have required=True should have allow_blank.


Related issues

Related to Pulp - Issue #3964: OpenAPI schema requires Progress Report suffix to be 1 char or longer MODIFIED Actions

Associated revisions

Revision bbd50620 View on GitHub
Added by CodeHeeler over 1 year ago

allow_blank for optional fields

Added allow_blank=True to all CharField serializers that are
not required.

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

Revision bbd50620 View on GitHub
Added by CodeHeeler over 1 year ago

allow_blank for optional fields

Added allow_blank=True to all CharField serializers that are
not required.

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

Revision bbd50620 View on GitHub
Added by CodeHeeler over 1 year ago

allow_blank for optional fields

Added allow_blank=True to all CharField serializers that are
not required.

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

History

#1 Updated by CodeHeeler over 1 year ago

  • Triaged changed from No to Yes

#2 Updated by amacdona@redhat.com over 1 year ago

During triage, I brought up the allow_null option, but we should use allow_blank, as it is preferred by DRF in the docs linked in the description.

#3 Updated by CodeHeeler over 1 year ago

  • Status changed from NEW to POST
  • Assignee set to CodeHeeler

#4 Updated by CodeHeeler over 1 year ago

  • Status changed from POST to MODIFIED

#5 Updated by daviddavis about 1 year ago

  • Related to Issue #3964: OpenAPI schema requires Progress Report suffix to be 1 char or longer added

#6 Updated by daviddavis 6 months ago

  • Sprint/Milestone set to 3.0

#7 Updated by bmbouter 6 months ago

  • Tags deleted (Pulp 3)

Please register to edit this issue

Also available in: Atom PDF