swagger-api / swagger-api/swagger-ui
Consumes */* in OpenAPI breaks Swagger UI
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Consumes set to / in OpenAPI spec, breaks swagger ui request.
For example in Kubernetes:
curl -X DELETE "HOST/api/v1/namespaces/test-namespace/pods/test-pod?propagationPolicy=Background" -H "accept: application/json" -H "Content-Type: /" -d "{ "propagationPolicy": "Background"}"
breaks in app because it takes / literally, instead you should be able to choose from:
- application/json
- application/yaml
- application/vnd.kubernetes.protobuf
Such curl requests will results in:
"message": "the body of the request was in an unknown format - accepted media types include: application/json, application/yaml, application/vnd.kubernetes.protobuf",
"reason": "UnsupportedMediaType",
Is there a way to add custom content-types when / is matched?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the Kubernetes DELETE request in Swagger UI from an OpenAPI spec whose consumes value is /. Trace how Swagger UI turns the matched media type into the request Content-Type, then verify that supported custom content types can be selected and sent instead of /.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, openapi
- Domain
- api
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100