swagger-api / swagger-api/swagger-codegen
-l html does not handle $ref to simple string schema
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
The attached swagger.yaml defines a schema named stringOption which is type string with an enum.
The other schema context uses it.
In the output for -l html the enum values are not presented/rendered.
Swagger-codegen version
2.2.3-SNAPSHOT
Swagger declaration file content or url
swagger: '2.0'
info:
version: '1'
title: swagger-codegen-string-ref-issue
description: a $ref to a string schema is not rendered correctly for -i html
paths:
/contexts:
post:
summary: Create a context
description: Create a context.
operationId: createContext
consumes:
- application/json
produces:
- application/json
parameters:
- name: body
in: body
description: Context definition
required: true
schema:
$ref: '#/definitions/context'
responses:
'201':
description: Context created
schema:
$ref: '#/definitions/context'
definitions:
context:
type: object
required:
- stringOption
- name
properties:
name:
description: The context name
type: string
stringOption:
$ref: '#/definitions/stringOption'
stringOption:
description: The context launch type
type: string
enum:
- valueA
- valueB
default: valueB
example: valueA
Command line used for generation
java -jar swagger-codegen-cli.jar generate -l html -o /tmp -i ref-string-schema.yaml
Steps to reproduce
run swagger-codegen ; view /tmp/index.html
See attached index.html output
Related issues/PRs
Suggest a fix/enhancement
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 by running swagger-codegen-cli.jar with the provided ref-string-schema.yaml and inspect the generated /tmp/index.html. Trace the HTML generation path for the referenced stringOption schema; done means the enum values valueA and valueB are rendered in the output.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- html, java
- Domain
- documentation, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100