openapi: 3.0.1
info:
title:
description:
version:
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
examples: # Child of media type
Jessica: # Example 1
value:
id: 10
name: Jessica Smith
Ron: # Example 2
value:
id: 11
name: Ron Stewart
responses:
'200':
description: A user object.
content:
application/json:
schema:
$ref: '#/components/schemas/User' # Reference to an object
examples:
Jessica:
value:
id: 10
name: Jessica Smith
Ron:
value:
id: 20
name: Ron Stewart
components:
schemas:
User:
type: object
properties:
id:
type: integer
format: int64
example: 1
name:
type: string
example: New order
and run generation:
docker run --rm \
-v $PWD:/local \
swaggerapi/swagger-codegen-cli-v3:3.0.27 \
generate \
-i /local/openapi.yaml \
-o /local/html \
-l html
Hi! I get code from example of docs: https://swagger.io/docs/specification/adding-examples/
and
and see:
Why
Ron
andJessica
is content type? The documentation doesn't have it.src\main\resources\handlebars\htmlDocs\index.mustache
Reproduce:
and run generation: