Skip to content

[Java][Spring] Annotate deprecated fluent model setters with @Deprecated - #24705

Open
kalayciburak wants to merge 3 commits into
OpenAPITools:masterfrom
kalayciburak:fix/24704-spring-deprecated-fluent-setters
Open

[Java][Spring] Annotate deprecated fluent model setters with @Deprecated#24705
kalayciburak wants to merge 3 commits into
OpenAPITools:masterfrom
kalayciburak:fix/24704-spring-deprecated-fluent-setters

Conversation

@kalayciburak

@kalayciburak kalayciburak commented Aug 14, 2026

Copy link
Copy Markdown

The Java Spring generator already annotates fields, getters, regular setters, and nested builder methods for properties marked deprecated: true. Fluent model setters and collection helpers (addXItem / putXItem) were missing @Deprecated.

This updates JavaSpring/pojo.mustache so those methods emit @Deprecated as well, including inherited fluent helpers.

Fixes #24704

PR checklist

  • Read the contribution guidelines.
  • Ran the following to build the project and update samples:
    ./mvnw -pl modules/openapi-generator-cli -am package -DskipTests=true -Dmaven.javadoc.skip=true -Djacoco.skip=true
    ./bin/generate-samples.sh ./bin/configs/spring*.yaml
    
    Regenerated Spring samples only. The sample delta is @Deprecated on fluent setters and collection helpers for already-deprecated properties (for example Pet.status).
  • If your PR is targeting a particular programming language, @mention the technical committee members, so they are more likely to review the pull request.

Java Spring @cachescrubber (2022/02) @welshm (2022/02) @MelleD (2022/02) @atextor (2022/02) @manedev79 (2022/02) @javisst (2022/02) @borsch (2022/02) @banlevente (2022/02) @Zomzog (2022/09) @martin-mfg (2023/08) @KannaKim (2026/07)

Tests

Executed:

  • ./mvnw -pl modules/openapi-generator -am test -Dtest=SpringCodegenTest#contractWithDeprecatedPropertiesAnnotatesFluentSettersAndCollectionHelpers RED then GREEN
  • ./mvnw -pl modules/openapi-generator -am test -Dtest=SpringCodegenTest#contractWithDeprecatedEnumGeneratesDeprecatedAnnotation,SpringCodegenTest#contractWithDeprecatedPropertiesAnnotatesFluentSettersAndCollectionHelpers,SpringCodegenTest#shouldGenerateSingleDeprecatedAnnotation 3/3 GREEN

Summary by cubic

Annotates Spring-generated fluent setters and collection helpers for deprecated properties. Old: no markers on fluent methods and some @deprecated Javadoc tags were empty. New: fluent and inherited helpers emit @Deprecated and @deprecated deprecated; regular setters’ Javadoc tag now includes text to avoid Javadoc warnings.

  • Template: updates modules/openapi-generator/src/main/resources/JavaSpring/pojo.mustache to add @Deprecated and @deprecated deprecated on fluent setters (prop(value)), addXItem(...), putXItem(...), and inherited equivalents when the schema property is deprecated; also updates existing setter Javadoc to @deprecated deprecated.
  • Tests/samples: adds src/test/resources/3_0/spring/issue_24704.yaml; extends SpringCodegenTest to assert annotations/Javadoc on fluent, collection helper, and builder methods; regenerates Spring samples.
  • Impact: No runtime change. IDE/compiler/Javadoc may now warn on deprecated fluent calls. No migration required.

Written for commit 656ac60. Summary will update on new commits.

Review in cubic

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All reported issues were addressed across 50 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

@wing328

wing328 commented Aug 18, 2026

Copy link
Copy Markdown
Member

thanks for the PR

can you please review the feedback in #24705 (comment) ?

@kalayciburak

Copy link
Copy Markdown
Author

yep, added the javadoc tag on fluent setters too

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 49 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java:165">
P3: The `@deprecated` javadoc tag is emitted with no description text, so javadoc builds of the generated code emit the warning `@deprecated tag has no <Text>` and users get no guidance on what to use instead. Add the replacement guidance in the tag, e.g. `* @deprecated Use {@link #getPhotoUrls()} instead`, matching the `@Deprecated` indication.</violation>
</file>

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

}

/**
* @deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The @deprecated javadoc tag is emitted with no description text, so javadoc builds of the generated code emit the warning @deprecated tag has no <Text> and users get no guidance on what to use instead. Add the replacement guidance in the tag, e.g. * @deprecated Use {@link #getPhotoUrls()} instead, matching the @Deprecated indication.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/client/petstore/spring-cloud-deprecated/src/main/java/org/openapitools/model/Pet.java, line 165:

<comment>The `@deprecated` javadoc tag is emitted with no description text, so javadoc builds of the generated code emit the warning `@deprecated tag has no <Text>` and users get no guidance on what to use instead. Add the replacement guidance in the tag, e.g. `* @deprecated Use {@link #getPhotoUrls()} instead`, matching the `@Deprecated` indication.</comment>

<file context>
@@ -161,12 +161,18 @@ public void setName(JsonNullable<String> name) {
   }
 
+  /**
+   * @deprecated
+   */
   @Deprecated
</file context>



Fluent setters and collection helpers generated from deprecated schema
properties now emit @deprecated, matching getters, setters, and nested
builder methods.

Fixes OpenAPITools#24704
Keep generated fluent setters and collection helpers consistent
with getters/setters for deprecated properties.
@kalayciburak
kalayciburak force-pushed the fix/24704-spring-deprecated-fluent-setters branch from 0cbc581 to 32f8dab Compare August 19, 2026 14:16
@wing328

wing328 commented Aug 24, 2026

Copy link
Copy Markdown
Member

can you please review the feedback in #24705 (comment)

Javadoc @deprecated with no text warns on generated models.
Use the same "deprecated" wording as the Spring enum templates.
@kalayciburak

Copy link
Copy Markdown
Author

added the tag text. skipped inventing a replacement method, spec doesn't name one

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

15 issues found across 49 files (changes from recent commits).

Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java:225">
P3: The added javadoc text 'deprecated' makes the generated doc read redundantly ('Deprecated. deprecated.') and is inconsistent with the getter for the same property, which keeps a bare '@deprecated'. The '@deprecated' Javadoc tag is meant to carry a description of what to use instead, so the filler word adds no information. Either drop the redundant text to match the getter, or give the tag a real description when one exists.</violation>
</file>

<file name="samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Pet.java:233">
P3: The `@deprecated` javadoc tag now reads `@deprecated deprecated`: the word "deprecated" is added as the tag's description text, which is tautological and adds no information (the `@Deprecated` annotation and tag already say it is deprecated). It is also inconsistent with the getter for the same property, which still uses a bare `@deprecated`. If no replacement method exists, emit a bare `@deprecated` as the getter does, or a meaningful deprecation message; otherwise the generated API surfaces an odd "deprecated deprecated" comment.</violation>
</file>

<file name="samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java:220">
P3: The javadoc tag text `deprecated` just repeats the tag keyword and adds no information for IDE tooltips, and it is inconsistent with the getter, which still emits a bare `@deprecated` with no text. If the intent is to give the `@deprecated` tag a meaningful description, reuse the property `{{description}}` (e.g. `* @deprecated {{description}}`) or a clear message like "will be removed in a future release" instead of the literal string "deprecated".</violation>
</file>

<file name="samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java:228">
P3: The fluent setter and setter now emit `@deprecated deprecated`, where the tag text just repeats the tag name and adds no information. Use a meaningful reason instead, e.g. the property's schema description (`pet status in the store`), so the deprecated Javadoc actually explains why the method is deprecated.</violation>
</file>

<file name="samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/client/petstore/spring-stubs-skip-default-interface/src/main/java/org/openapitools/model/Pet.java:225">
P3: The generated javadoc reads `@deprecated deprecated`, which renders as the redundant "Deprecated. deprecated." and adds no information. It is also inconsistent with the getter for the same property, which still emits a bare `@deprecated`. Use the schema description as the tag text (or leave the tag empty for consistency with the getter) instead of the hardcoded literal "deprecated".</violation>
</file>

<file name="samples/client/petstore/spring-http-interface-oauth/src/main/java/org/openapitools/model/PetDto.java">

<violation number="1" location="samples/client/petstore/spring-http-interface-oauth/src/main/java/org/openapitools/model/PetDto.java:216">
P3: The generated javadoc `@deprecated deprecated` repeats the tag name as its message, so the rendered docs read "Deprecated. Deprecated." and add no information. It is also inconsistent with the getter (e.g. `getStatus`) which still emits a bare `@deprecated` with no text for the same property. Use a useful message (the property name or a replacement) or omit the text for consistency with the getter.</violation>
</file>

<file name="samples/openapi3/server/petstore/springboot-4/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/server/petstore/springboot-4/src/main/java/org/openapitools/model/Pet.java:271">
P3: The javadoc tag text added by this delta is the literal word "deprecated", producing the redundant "@deprecated deprecated" in the generated fluent setter and setter. It repeats the tag name and carries no information about the deprecation, and it is inconsistent with the getter of the same property which still emits "@deprecated" with no text. Use a meaningful generic replacement phrase (e.g. "This property will be removed in a future release.") or leave the tag without text consistently; apply the same choice across getter, setter, and fluent setter.</violation>
</file>

<file name="samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/client/petstore/spring-http-interface-reactive/src/main/java/org/openapitools/model/Pet.java:221">
P3: For the same deprecated property, the fluent `status(...)` and `setStatus(...)` javadoc now read `@deprecated deprecated`, but `getStatus()` still emits a bare `@deprecated`. Within one property the generated javadoc is now inconsistent. If the added tag text is meant to be the standard description, apply it to the getter's `@deprecated` tag in pojo.mustache as well for consistency (or drop it everywhere and keep the bare tag).</violation>
</file>

<file name="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/server/petstore/springboot-reactive/src/main/java/org/openapitools/model/Pet.java:228">
P3: The generated javadoc reads `@deprecated deprecated`, where the tag is followed by the redundant literal word "deprecated" as its description. This gives readers no useful replacement advice and reads oddly in the generated API. Either drop the redundant text or use a more informative description (as already done on the getter, which uses a bare `@deprecated`).</violation>
</file>

<file name="samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java:228">
P3: The javadoc tag text is the literal word 'deprecated', which renders as 'Deprecated. deprecated.' and is redundant. It is also inconsistent with the getter (getStatus()), which uses a bare '@deprecated' with no text. Prefer omitting the tag text or use the property description instead of the hardcoded word 'deprecated'.</violation>
</file>

<file name="samples/openapi3/client/petstore/spring-cloud-http-basic/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/client/petstore/spring-cloud-http-basic/src/main/java/org/openapitools/model/Pet.java:225">
P3: These fluent setters, collection helpers, and setters emit '@deprecated deprecated' in their javadoc, but the class and getter javadoc in the same file emit plain '@deprecated'. The literal word 'deprecated' as the @deprecated tag text is redundant (the @Deprecated annotation already conveys it) and inconsistent; a @deprecated tag should describe a replacement or reason. Either keep the tag text empty like the getter, or render an actual description/replacement instead of the hardcoded word 'deprecated'.</violation>
</file>

<file name="samples/server/petstore/springboot/src/main/java/org/openapitools/model/PetDto.java">

<violation number="1" location="samples/server/petstore/springboot/src/main/java/org/openapitools/model/PetDto.java:231">
P3: The javadoc `@deprecated` tag text is just the literal word "deprecated", which repeats the tag name: Javadoc already pre-renders "Deprecated." before the text, so generated API docs read "Deprecated. deprecated." with no guidance on what to use instead. Most Java toolchains also flag `@deprecated` without meaningful text, but repeating the tag word does not satisfy the intent. If no replacement is named, consider generating a clearer message or leaving the tag text out rather than emitting a placeholder that just echoes the tag name.</violation>
</file>

<file name="samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java:221">
P3: The javadoc text `@deprecated deprecated` is tautological and uninformative: it repeats the keyword and tells users nothing about what to use instead. The Java convention for `@deprecated` is to name the replacement or reason, and the surrounding getter javadoc in the same generated class uses a plain `@deprecated`. Either emit meaningful text (e.g. property `deprecated` description or replacement guidance) or keep it consistent with the getter rather than the literal word "deprecated".</violation>
</file>

<file name="samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/model/Pet.java:218">
P3: The added javadoc now reads `@deprecated deprecated` because the template hardcodes the literal word "deprecated" as the `@deprecated` reason. That is redundant and it is inconsistent with the getter, which this same file still emits as a bare `@deprecated`. Emit a bare `@deprecated` in these blocks too (matching the getter), or use a real deprecation reason, so the generated javadoc is consistent.</violation>
</file>

<file name="samples/openapi3/client/petstore/spring-cloud-4-with-optional/src/main/java/org/openapitools/model/Pet.java">

<violation number="1" location="samples/openapi3/client/petstore/spring-cloud-4-with-optional/src/main/java/org/openapitools/model/Pet.java:223">
P2: The generated getter still emits `@deprecated` with no description, so the javadoc warning this change fixes persists on every deprecated property getter. The commit message's stated goal is that "Javadoc @deprecated with no text warns on generated models," but the getter block in pojo.mustache was not updated alongside the setter and fluent-helper blocks, leaving the generated model inconsistent (e.g. Pet.status(): getStatus() warns, setStatus()/status() do not). Update the getter's `@deprecated` to `@deprecated deprecated` in the same template to complete the fix.</violation>
</file>

Tip: Review your code locally with the cubic CLI to iterate faster.

Re-trigger cubic

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: The generated getter still emits @deprecated with no description, so the javadoc warning this change fixes persists on every deprecated property getter. The commit message's stated goal is that "Javadoc @deprecated with no text warns on generated models," but the getter block in pojo.mustache was not updated alongside the setter and fluent-helper blocks, leaving the generated model inconsistent (e.g. Pet.status(): getStatus() warns, setStatus()/status() do not). Update the getter's @deprecated to @deprecated deprecated in the same template to complete the fix.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/spring-cloud-4-with-optional/src/main/java/org/openapitools/model/Pet.java, line 223:

<comment>The generated getter still emits `@deprecated` with no description, so the javadoc warning this change fixes persists on every deprecated property getter. The commit message's stated goal is that "Javadoc @deprecated with no text warns on generated models," but the getter block in pojo.mustache was not updated alongside the setter and fluent-helper blocks, leaving the generated model inconsistent (e.g. Pet.status(): getStatus() warns, setStatus()/status() do not). Update the getter's `@deprecated` to `@deprecated deprecated` in the same template to complete the fix.</comment>

<file context>
@@ -220,7 +220,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The added javadoc text 'deprecated' makes the generated doc read redundantly ('Deprecated. deprecated.') and is inconsistent with the getter for the same property, which keeps a bare '@deprecated'. The '@deprecated' Javadoc tag is meant to carry a description of what to use instead, so the filler word adds no information. Either drop the redundant text to match the getter, or give the tag a real description when one exists.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/spring-stubs/src/main/java/org/openapitools/model/Pet.java, line 225:

<comment>The added javadoc text 'deprecated' makes the generated doc read redundantly ('Deprecated. deprecated.') and is inconsistent with the getter for the same property, which keeps a bare '@deprecated'. The '@deprecated' Javadoc tag is meant to carry a description of what to use instead, so the filler word adds no information. Either drop the redundant text to match the getter, or give the tag a real description when one exists.</comment>

<file context>
@@ -222,7 +222,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>
Suggested change
* @deprecated deprecated
* @deprecated

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The @deprecated javadoc tag now reads @deprecated deprecated: the word "deprecated" is added as the tag's description text, which is tautological and adds no information (the @Deprecated annotation and tag already say it is deprecated). It is also inconsistent with the getter for the same property, which still uses a bare @deprecated. If no replacement method exists, emit a bare @deprecated as the getter does, or a meaningful deprecation message; otherwise the generated API surfaces an odd "deprecated deprecated" comment.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-beanvalidation-no-nullable/src/main/java/org/openapitools/model/Pet.java, line 233:

<comment>The `@deprecated` javadoc tag now reads `@deprecated deprecated`: the word "deprecated" is added as the tag's description text, which is tautological and adds no information (the `@Deprecated` annotation and tag already say it is deprecated). It is also inconsistent with the getter for the same property, which still uses a bare `@deprecated`. If no replacement method exists, emit a bare `@deprecated` as the getter does, or a meaningful deprecation message; otherwise the generated API surfaces an odd "deprecated deprecated" comment.</comment>

<file context>
@@ -230,7 +230,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>
Suggested change
* @deprecated deprecated
* @deprecated

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The javadoc tag text deprecated just repeats the tag keyword and adds no information for IDE tooltips, and it is inconsistent with the getter, which still emits a bare @deprecated with no text. If the intent is to give the @deprecated tag a meaningful description, reuse the property {{description}} (e.g. * @deprecated {{description}}) or a clear message like "will be removed in a future release" instead of the literal string "deprecated".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/spring-cloud-oas3-fakeapi/src/main/java/org/openapitools/model/Pet.java, line 220:

<comment>The javadoc tag text `deprecated` just repeats the tag keyword and adds no information for IDE tooltips, and it is inconsistent with the getter, which still emits a bare `@deprecated` with no text. If the intent is to give the `@deprecated` tag a meaningful description, reuse the property `{{description}}` (e.g. `* @deprecated {{description}}`) or a clear message like "will be removed in a future release" instead of the literal string "deprecated".</comment>

<file context>
@@ -217,7 +217,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The fluent setter and setter now emit @deprecated deprecated, where the tag text just repeats the tag name and adds no information. Use a meaningful reason instead, e.g. the property's schema description (pet status in the store), so the deprecated Javadoc actually explains why the method is deprecated.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot-implicitHeaders/src/main/java/org/openapitools/model/Pet.java, line 228:

<comment>The fluent setter and setter now emit `@deprecated deprecated`, where the tag text just repeats the tag name and adds no information. Use a meaningful reason instead, e.g. the property's schema description (`pet status in the store`), so the deprecated Javadoc actually explains why the method is deprecated.</comment>

<file context>
@@ -225,7 +225,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The javadoc tag text is the literal word 'deprecated', which renders as 'Deprecated. deprecated.' and is redundant. It is also inconsistent with the getter (getStatus()), which uses a bare '@deprecated' with no text. Prefer omitting the tag text or use the property description instead of the hardcoded word 'deprecated'.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/server/petstore/springboot-delegate/src/main/java/org/openapitools/model/Pet.java, line 228:

<comment>The javadoc tag text is the literal word 'deprecated', which renders as 'Deprecated. deprecated.' and is redundant. It is also inconsistent with the getter (getStatus()), which uses a bare '@deprecated' with no text. Prefer omitting the tag text or use the property description instead of the hardcoded word 'deprecated'.</comment>

<file context>
@@ -225,7 +225,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: These fluent setters, collection helpers, and setters emit '@deprecated deprecated' in their javadoc, but the class and getter javadoc in the same file emit plain '@deprecated'. The literal word 'deprecated' as the @deprecated tag text is redundant (the @deprecated annotation already conveys it) and inconsistent; a @deprecated tag should describe a replacement or reason. Either keep the tag text empty like the getter, or render an actual description/replacement instead of the hardcoded word 'deprecated'.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/client/petstore/spring-cloud-http-basic/src/main/java/org/openapitools/model/Pet.java, line 225:

<comment>These fluent setters, collection helpers, and setters emit '@deprecated deprecated' in their javadoc, but the class and getter javadoc in the same file emit plain '@deprecated'. The literal word 'deprecated' as the @deprecated tag text is redundant (the @Deprecated annotation already conveys it) and inconsistent; a @deprecated tag should describe a replacement or reason. Either keep the tag text empty like the getter, or render an actual description/replacement instead of the hardcoded word 'deprecated'.</comment>

<file context>
@@ -222,7 +222,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The javadoc @deprecated tag text is just the literal word "deprecated", which repeats the tag name: Javadoc already pre-renders "Deprecated." before the text, so generated API docs read "Deprecated. deprecated." with no guidance on what to use instead. Most Java toolchains also flag @deprecated without meaningful text, but repeating the tag word does not satisfy the intent. If no replacement is named, consider generating a clearer message or leaving the tag text out rather than emitting a placeholder that just echoes the tag name.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/server/petstore/springboot/src/main/java/org/openapitools/model/PetDto.java, line 231:

<comment>The javadoc `@deprecated` tag text is just the literal word "deprecated", which repeats the tag name: Javadoc already pre-renders "Deprecated." before the text, so generated API docs read "Deprecated. deprecated." with no guidance on what to use instead. Most Java toolchains also flag `@deprecated` without meaningful text, but repeating the tag word does not satisfy the intent. If no replacement is named, consider generating a clearer message or leaving the tag text out rather than emitting a placeholder that just echoes the tag name.</comment>

<file context>
@@ -228,7 +228,7 @@ public void setTags(List<@Valid TagDto> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The javadoc text @deprecated deprecated is tautological and uninformative: it repeats the keyword and tells users nothing about what to use instead. The Java convention for @deprecated is to name the replacement or reason, and the surrounding getter javadoc in the same generated class uses a plain @deprecated. Either emit meaningful text (e.g. property deprecated description or replacement guidance) or keep it consistent with the getter rather than the literal word "deprecated".

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/server/petstore/springboot/src/main/java/org/openapitools/model/Pet.java, line 221:

<comment>The javadoc text `@deprecated deprecated` is tautological and uninformative: it repeats the keyword and tells users nothing about what to use instead. The Java convention for `@deprecated` is to name the replacement or reason, and the surrounding getter javadoc in the same generated class uses a plain `@deprecated`. Either emit meaningful text (e.g. property `deprecated` description or replacement guidance) or keep it consistent with the getter rather than the literal word "deprecated".</comment>

<file context>
@@ -218,7 +218,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>
Suggested change
* @deprecated deprecated
* @deprecated Use the replacement property/method instead of this deprecated one.

}

/**
* @deprecated deprecated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: The added javadoc now reads @deprecated deprecated because the template hardcodes the literal word "deprecated" as the @deprecated reason. That is redundant and it is inconsistent with the getter, which this same file still emits as a bare @deprecated. Emit a bare @deprecated in these blocks too (matching the getter), or use a real deprecation reason, so the generated javadoc is consistent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At samples/openapi3/server/petstore/springboot-source/src/main/java/org/openapitools/model/Pet.java, line 218:

<comment>The added javadoc now reads `@deprecated deprecated` because the template hardcodes the literal word "deprecated" as the `@deprecated` reason. That is redundant and it is inconsistent with the getter, which this same file still emits as a bare `@deprecated`. Emit a bare `@deprecated` in these blocks too (matching the getter), or use a real deprecation reason, so the generated javadoc is consistent.</comment>

<file context>
@@ -215,7 +215,7 @@ public void setTags(List<@Valid Tag> tags) {
 
   /**
-   * @deprecated
+   * @deprecated deprecated
    */
   @Deprecated
</file context>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG][JAVA][SPRING] Fluent model setters for deprecated properties are not annotated with @Deprecated

2 participants