Project

Profile

Help

Issue #4722

closed

Using the "fields=" feature has strange behavior with "created_resources"

Added by dalley almost 5 years ago. Updated over 4 years ago.

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

Description

Pulp has a features where you can give a list of field names when GET'ing an endpoint and it will return just those fields. This doesn't work with "created_resources"

(pulp) [vagrant@pulp3-source-fedora29 pulpcore]$ http GET :8000/pulp/api/v3/tasks/?fields=created_resources
HTTP/1.1 200 OK
Allow: GET, HEAD, OPTIONS
Connection: close
Content-Length: 252
Content-Type: application/json
Date: Sat, 20 Apr 2019 05:22:33 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 5,
    "next": null,
    "previous": null,
    "results": [
        {
            "created_resources": [
                null
            ]
        },
        {
            "created_resources": []
        },
        {
            "created_resources": []
        },
        {
            "created_resources": []
        },
        {
            "created_resources": [
                null
            ]
        }
    ]

...unless you also ask for the "_href" field...

(pulp) [vagrant@pulp3-source-fedora29 pulpcore]$ http GET :8000/pulp/api/v3/tasks/?fields=created_resources,_href                                                                                                  
HTTP/1.1 200 OK                                                                                                                                                                                                    
Allow: GET, HEAD, OPTIONS                                                                                                                                                                                          
Connection: close                                                                                                                                                                                                  
Content-Length: 1153                                                                                                                                                                                               
Content-Type: application/json
Date: Sat, 20 Apr 2019 05:28:37 GMT
Server: gunicorn/19.9.0
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "count": 5,
    "next": null,
    "previous": null,
    "results": [
        {
            "_href": "/pulp/api/v3/tasks/53f70631-2291-4504-872c-2b0273e77be6/",
            "created_resources": [
                "/pulp/api/v3/repositories/ba02a128-5dcd-4c95-bbd7-137b4717fcea/versions/3/"
            ]
        },
        {
            "_href": "/pulp/api/v3/tasks/aed745a7-e6f1-41a6-abde-94eb1994c3ed/",
            "created_resources": []
        },
        {
            "_href": "/pulp/api/v3/tasks/2cef00bf-d413-411c-9e2b-62e12da35a21/",
            "created_resources": []
        },
        {
            "_href": "/pulp/api/v3/tasks/1d72663c-811f-4ec8-8069-bf1250d4cf56/",
            "created_resources": []
        },
        {
            "_href": "/pulp/api/v3/tasks/ef79f412-3521-4d10-9d75-62600916d1fa/",
            "created_resources": [
                "/pulp/api/v3/repositories/2cf65405-d4e0-43d2-8385-649eb314263c/versions/1/"
            ]
        }
    ]
}

Related issues

Related to RPM Support - Test #5180: Test scenario for filtering fields with created_resourcesCLOSED - COMPLETElmjachkyActions

Also available in: Atom PDF