swagger-api / swagger-api/swagger-codegen
[swagger-codegen Java] codegen generates invalid Java classes for descriptions of simple type integer or string
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
The following description section inside an OAI specification in yaml led to invalid java classes HelloWorldResponse.java and UsageLimit.java after code generation in version 2.1.5
definitions:
HelloWorldResponse:
type: string
UsageLimit:
type: integer
description: Defines the usage limit
ErrorResponse:
required:
- message
properties:
message:
type: string
see GIST [https://gist.github.com/h2m/322effb99d5261671ca1]
Is this a bug, an invalid specification or a problem with Java not being able to subclass a String or Integer type?
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 reviewing the YAML example and linked Gist, then inspect the generated HelloWorldResponse.java and UsageLimit.java from swagger-codegen 2.1.5. Determine whether the specification is valid and why code generation produces invalid Java classes; done means the cause is established and the issue has a clear resolution.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100