swagger-api / swagger-api/swagger-ui
`anyOf` parameters always listed as `X | (X | Y)`
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 29k
- Forks
- 9.3k
- Avg merge
- 2d 23h
- Merged PRs (30d)
- 25
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: FireFox
- Version: 140.5
- Method of installation: downloaded the pre-compiled bundle and used the
dist/directory - Swagger-UI version: 5.30.3
- Swagger/OpenAPI version: 3.1.0
Content & configuration
Example Swagger/OpenAPI definition:
{
"openapi": "3.1.0",
"paths": {
"/greet": {
"get": {
"parameters": [
{
"name": "name",
"schema": {
"anyOf": [
{
"type": "string"
},
{
"type": "integer"
}
]
}
}
]
}
}
}
}
Swagger-UI configuration options:
Not changed from defaults
Describe the bug you're encountering
To reproduce...
Steps to reproduce the behavior:
- Create an OpenAPI spec that uses
anyOffor a parameter - Look at the generated docs for that parameter
Expected behavior
In the above example, I expect to see string | integer
Screenshots
Additional context or thoughts
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
Reproduce the issue using the OpenAPI example and the downloaded dist/ directory, then trace how the generated documentation renders the parameter schema. Compare the current anyOf display with the expected string | integer output. Done means the parameter is shown without the redundant nested type expression and the existing behavior remains correct for other schemas.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100