swagger-api / swagger-api/swagger-codegen-generators
Bug: Content-Type of responces examples (html generator)
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 299
- Forks
- 439
- PR merge metrics
- No merged PRs in 30d
Description
Hi! I get code from example of docs: https://swagger.io/docs/specification/adding-examples/

and

and see:

Why Ron and Jessica is content type? The documentation doesn't have it.
src\main\resources\handlebars\htmlDocs\index.mustache

Reproduce:
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
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
Start with src/main/resources/handlebars/htmlDocs/index.mustache and reproduce the output using the provided OpenAPI YAML and Docker generation command. Trace how the example names are rendered and confirm that the generated HTML labels the response examples with the actual media type rather than Jessica or Ron.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html
- Domain
- documentation
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100