-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Open
Labels
cat: user experienceneeds: UX/design inputpull-request-welcomeIf a PR were to be made, we would help get it mergedIf a PR were to be made, we would help get it merged
Description
Q&A (please complete the following information)
- OS: macOS
- Browser: chrome
- Version: 95.0.4638.69
- Method of installation: non, using online version https://editor.swagger.io/
- Swagger-UI version: [e.g. 3.10.0]
- Swagger/OpenAPI version: OpenAPI 3.0.3
Example Swagger/OpenAPI definition:
openapi: 3.0.3
info:
title: 'My API'
version: 3.0.0
servers: []
paths:
/api_app:
post:
operationId: apiAppCreate
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/ApiAppCreateRequest'
responses:
'200':
description: 'success'
content:
application/json:
schema: {}
components:
schemas:
ApiAppCreateRequest:
properties:
oauth:
type: object
properties:
callback_url:
type: string
example: 'https://example.com/oauth'
scopes:
type: array
items:
type: string
example:
- basic_account_info
- request_signature
type: object
Describe the bug you're encountering
When a component schema is defined that has another object nested inside of it, the UI shows JSON instead of form fields in the "try it out" page.
To reproduce...
Steps to reproduce the behavior:
- Go to https://editor.swagger.io/
- Paste the above example
- Click on POST /api_app
- Click "Try it out"
- See JSON:
Expected behavior
I believe nested objects should be represented with UI fields like any other root-level field. For example, if I move callback_url
and scopes
into the top-level of ApiAppCreateRequest
:
openapi: 3.0.3
info:
title: 'My API'
version: 3.0.0
servers: []
paths:
/api_app:
post:
operationId: apiAppCreate
requestBody:
content:
multipart/form-data:
schema:
$ref: '#/components/schemas/ApiAppCreateRequest'
responses:
'200':
description: 'success'
content:
application/json:
schema: {}
components:
schemas:
ApiAppCreateRequest:
properties:
callback_url:
type: string
example: 'https://example.com/oauth'
scopes:
type: array
items:
type: string
example:
- basic_account_info
- request_signature
type: object
this is what I now see:
The problem is more obvious when you mix root-level properties with nested objects:
andreo-code, m3thom, k4emic, griesi007, botink27 and 11 morelatuconsinafr, rward27, dmke, Brunnn and shahen94
Metadata
Metadata
Assignees
Labels
cat: user experienceneeds: UX/design inputpull-request-welcomeIf a PR were to be made, we would help get it mergedIf a PR were to be made, we would help get it merged