Project

Profile

Help

Issue #6908

closed

Nullable DB fields cannot be set to null via the API

Added by quba42 over 4 years ago. Updated over 3 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version - Debian:
Platform Release:
Target Release - Debian:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:

Description

I noticed this while working with remotes, but it may well affect other things as well.

Stepos to reproduce:

  1. Create an example remote:
    http post :/pulp/api/v3/remotes/deb/apt/ name=tuxedo_remote distributions="bionic" components="main"architectures="i386 amd64" url="http://deb.tuxedocomputers.com/ubuntu/"
    
  2. Try to update the components to null:
    $ http patch :/pulp/api/v3/remotes/deb/apt/<uuid>/ components:=null --json
    HTTP/1.1 400 Bad Request
    Allow: GET, PUT, PATCH, DELETE, HEAD, OPTIONS
    Connection: keep-alive
    Content-Length: 46
    Content-Type: application/json
    Date: Thu, 04 Jun 2020 11:55:12 GMT
    Server: nginx/1.14.2
    Vary: Accept, Cookie
    X-Frame-Options: SAMEORIGIN
    
    {
        "components": [
            "This field may not be null."
        ]
    }
    

Note that it is perfectly legal to create the remote with the null field by simply omitting that option. Functionally it makes perfect sense to change your mind about this later. It should be allowed to null such nullable fields!

Actions #1

Updated by pulpbot over 4 years ago

  • Status changed from NEW to POST

Added by msinghal over 4 years ago

Revision 61f8a170 | View on GitHub

Fix nullable DB fields which could not be set to null via the API

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

Actions #2

Updated by msinghal over 4 years ago

  • Status changed from POST to MODIFIED
Actions #3

Updated by quba42 over 3 years ago

  • Status changed from MODIFIED to CLOSED - CURRENTRELEASE

Also available in: Atom PDF