Actions
Issue #4722
closedUsing the "fields=" feature has strange behavior with "created_resources"
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
Updated by amacdona@redhat.com over 5 years ago
- Sprint/Milestone set to 3.0.0
- Triaged changed from No to Yes
Updated by daviddavis over 5 years ago
- Groomed changed from No to Yes
- Sprint Candidate changed from No to Yes
Updated by dkliban@redhat.com over 5 years ago
- Sprint changed from Sprint 55 to Sprint 56
Updated by lmjachky over 5 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to lmjachky
Added by Lubos Mjachky over 5 years ago
Updated by lmjachky over 5 years ago
- Status changed from ASSIGNED to POST
Updated by Anonymous over 5 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulpcore|ac75012ba21e593bd3f017e81f3f56dc57a0de83.
Updated by kersom over 5 years ago
- Related to Test #5180: Test scenario for filtering fields with created_resources added
Updated by bmbouter about 5 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions
Fetch all fields when initializing a serializer
When a user used _href within the fields selection, the serializer could fetch a correct value from _href. This commit removes a need to specify _href while filtering fields from the response.
When the data model will change, this may cause performance drawbacks due to serializing all fields of Task objects.
closes #4722 https://pulp.plan.io/issues/4722