OpenAPITools / OpenAPITools/openapi-generator
[REQ] [java] [templates] setter properties should also include the description as jdocs
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
Is your feature request related to a problem? Please describe.
in my IDE (intellij) i want to see the jdoc also on setters of properties
Describe the solution you'd like
add the jdoc derived from the property's description also to the setters
Describe alternatives you've considered
n/a
Additional context
given the model
Foo:
type: object
properties:
bar:
description: bar comment
type: string
the java/spring generator produces:
public Foo bar(String bar) {
this.bar = bar;
return this;
}
/**
* bar comment
* @return bar
*/
@Schema(name = "bar", description = "bar comment", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
@JsonProperty("bar")
public String getBar() {
return bar;
}
public void setBar(String bar) {
this.bar = bar;
}
...
i want a generated jdoc on getBar() also on setBar() and bar(String)
suggestion:
/**
* ${decription}
*/
Notes:
- this ticket could also be applicable to other languages
- tested against 6.5.0
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 at the Java/Spring generator templates that render model properties, using the provided Foo YAML and generated methods as the entry point. Generate the model and compare getBar(), setBar(), and bar(String); done means the property's description appears as Javadoc on the setter and fluent setter as requested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100