swagger-ui: Swagger-UI can't render `content` inside a parameter
| Q | A |
|---|---|
| Bug or feature request? | Bug |
| Which Swagger/OpenAPI version? | 3.0.0 |
| Which Swagger-UI version? | v3.13.4 |
| How did you install Swagger-UI? | standalone-dist |
| Which browser & version? | Firefox 61.0a1 |
| Which operating system? | Mac Sierra |
Demonstration API definition
Try and add a query parameter referencing an object (which according to the spec is a valid thing to do)
- name: users
in: query
description: List of users to query for
content:
application/json:
schema:
$ref: "#/components/schemas/UserArray"
components:
schemas:
UserArray:
type: array
items:
$ref: "#/components/schemas/User"
User:
required:
- userId
- currency
properties:
userId:
type: integer
format: int32
currency:
type: string
Configuration (browser query string, constructor, config.yaml)
I am using no additional config options, everything is vanilla.
Expected Behavior
The UI should offer me a nice way of typing in arrays of objects in a query param. According to the documentation this should be possible:
in: query
name: coordinates
content:
application/json:
schema:
type: object
required:
- lat
- long
properties:
lat:
type: number
long:
type: number
Current Behavior
Context
Just an honest labourer trying to document a horrendous API I didn’t write 🤣
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 15
- Comments: 16 (7 by maintainers)
@shockey do you guys have any plan to support this? Or is there any chance that we can help/ contribute.
@vinhlh : Yes, just follow the way of writing the path parameters and query parameters on the link: https://swagger.io/docs/specification/describing-parameters/
It really worked for me.
The solution to the problem : “😱 Could not render this component, see the console.” in Swagger Open API 3 can be resolved by following the link: https://swagger.io/docs/specification/describing-parameters/
@ksac1, @hkosova probably wrote that documentation 😉
To clarify for those reading along: Swagger UI is indeed missing support for
contentdata within parameters. We’re tracking this as a feature request!@ksac1 there are two ways to define the parameter data - using
schemaand usingcontent. Parameters withschemaare displayed properly in Swagger UI. This issue is specifically about parameters withcontent.@jessebrennan Thanks, the documentation has been updated to reflect that parameters with
contentare supported in Swagger UI 3.23.7+ and Swagger Editor 3.6.34+.@hkosova :
@hkosova That is the case unfortunately, horrific I know…
Perhaps this kind of thing should never be possible then it would encourage people to write nice API’s ☮️