Actions
Issue #4683
closedOpenAPI schema for Artifacts create operation is ambiguous
Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
No
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Quarter:
Description
The bindings generated from Pulp's OpenAPI schema don't form-encode requests for the 'artifacts_create' operation. This results in a 400 error being returned by the server.
Actions
Problem: OpenAPI schema for 'Artifact create' is ambiguous
Solution: Remove JSONParser from ArtifactViewset
The ArtifactViewset viewset was configured to use MultiPartParser, FormParser, and JSONParser. The JSONParser was added when the ArtifactViewset was extended to accept uploads when creating an Artifact. It was only needed to allow users to submit not form-encoded requests to the /pulp/api/v3/artifacts/ endpoint. However, 'drf_yasg' does not support mixing multipart/form-data and json fields. When such occurs, the body parameters for the operation are simply reported as 'data' dictionary. The bindings generated from such an OpenAPI schema don't form-encode requests for the 'artifacts_create' operation. This results in a 400 error being returned by the server.
fixes: #4683 https://pulp.plan.io/issues/4683