-
Notifications
You must be signed in to change notification settings - Fork 9.2k
Closed
Closed
Copy link
Labels
Description
Q | A |
---|---|
Bug or feature request? | bug |
Which Swagger/OpenAPI version? | 3.0.0 |
Which Swagger-UI version? | |
How did you install Swagger-UI? | use the online version on app.swaggerhub.com |
Which browser & version? | chrome |
Which operating system? | osx |
Demonstration API definition
I test the online hub https://app.swaggerhub.com use the yaml code following, but I get the unexpected generation at right side of the page (like the following screenshot). I think it will generated like the document (https://swagger.io/docs/specification/describing-request-body/) as the example in requestBody.content. will override which defined in schema but it seems like the example I defined makes no sense.
https://app.swaggerhub.com/apis/liu946/ssp/1.0.0
paths:
/users:
post:
summary: Adds a new user
requestBody:
content:
application/json: # Media type
schema: # Request body contents
$ref: '#/components/schemas/User' # Reference to an object
example: # Child of media type because we use $ref above
# Properties of a referenced object
id: 10
name: Jessica Smith
responses:
'200':
description: OK
components:
schemas:
# basic data structure
User:
type: object
properties:
id:
type: integer
name:
type: string
Expected Behavior
generate example object like { id: 10, name: Jessica Smith}
Current Behavior
generate a {id: 0, name: "string"} object
Waiting for your help, please.
nielskrijger, kand617 and kzhou57