Project

Profile

Help

Issue #6908

Nullable DB fields cannot be set to null via the API

Added by quba42 5 months ago. Updated 4 months ago.

Status:
MODIFIED
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!

Associated revisions

Revision 61f8a170 View on GitHub
Added by msinghal 4 months ago

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

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

History

#1 Updated by pulpbot 4 months ago

  • Status changed from NEW to POST

#2 Updated by msinghal 4 months ago

  • Status changed from POST to MODIFIED

Please register to edit this issue

Also available in: Atom PDF