Actions
Issue #3755
closedallow_blank is not set to true for optional fields
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Easy Fix
Sprint:
Quarter:
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
Updated by amacdona@redhat.com over 6 years 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.
Updated by CodeHeeler over 6 years ago
- Status changed from NEW to POST
- Assignee set to CodeHeeler
Added by CodeHeeler over 6 years ago
Added by CodeHeeler over 6 years ago
Revision bbd50620 | View on GitHub
allow_blank for optional fields
Added allow_blank=True to all CharField serializers that are not required.
Updated by CodeHeeler over 6 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulp|bbd50620678a9f07e9a31e287661489baac8e78e.
Updated by daviddavis about 6 years ago
- Related to Issue #3964: OpenAPI schema requires Progress Report suffix to be 1 char or longer added
Updated by bmbouter almost 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions
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