swagger-api / swagger-api/swagger-codegen
[JAVA] Extend classes in generated models not defined in YAML file
Nobody has claimed this yet.
- Dominant language
- Mustache
- Stars
- 17.8k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Description
I would like to use the class as base class not defined in YAML file. Through import mapping, we can use classes which are not defined in YAML file as a members, but could not figure out how to use them as base class.
Swagger-codegen version
2.2.3
Swagger declaration file content or url
child:
description: "Model that extends user defined model."
allOf:
- $ref: "UserDefinedModel"
- type: "object"
properties:
childField:
type: "string"
Command line used for generation
NA (normal command with required parameters)
Steps to reproduce
Not a bug
Related issues/PRs
Suggest a fix/enhancement
Need a way to use external class to use as a base class.
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 reproducing the YAML example using the Java generator and review how import mapping currently handles external member types. Determine the intended behavior for an external base class in an allOf model, then verify that generated models extend it without requiring a YAML definition.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100