Skip to content

Fixing template to support javadocs generation for arrays and maps - #2010

Merged
poojah-adyen merged 1 commit into
mainfrom
fix-list-javadoc-creation
Jul 21, 2026
Merged

Fixing template to support javadocs generation for arrays and maps#2010
poojah-adyen merged 1 commit into
mainfrom
fix-list-javadoc-creation

Conversation

@poojah-adyen

Copy link
Copy Markdown
Contributor

Description

The Javadoc build fails with error:
unexpected text when a generated API method has a parameter or return type that is a generic container (e.g. List<ExecutionResult>).
This PR fixes the OpenAPI Mustache template so those types render as valid Javadoc.

The api_summary.mustache template embedded the parameter/return type inside a {@link} tag using double-brace interpolation ({@link {{dataType}} }). Mustache HTML-escapes {{ }}, so a generic type like List was emitted as:

  @param results {@link
     List&lt;ExecutionResult&gt; } ...

This never surfaced before because the {@link } pattern is only used for operation parameters/return types (model fields use the property name, not the type), and no prior operation had a container-typed parameter or return.

Tested scenarios

Fixed issue:
For container types (isContainer), render the type with {@code} (which safely handles angle brackets and needs no reference resolution) using unescaped triple-brace interpolation.
Non-container types are unchanged and still use clickable {@link}.

• List → {@code List } (valid, renders the full generic type)
• String, Integer, model classes → still {@link ... } (clickable, unchanged)

Applied to path params, body params, query params, and the @return tag.

@poojah-adyen poojah-adyen self-assigned this Jul 20, 2026
@poojah-adyen
poojah-adyen requested a review from a team as a code owner July 20, 2026 07:20
@poojah-adyen poojah-adyen added the Fix Indicates a bug fix label Jul 20, 2026

@gemini-code-assist gemini-code-assist 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.

Code Review

This pull request updates the Javadoc template for Jersey3 to conditionally use {@code} for container types (such as lists or maps) and {@link} for standard types across path, body, query parameters, and return types. This prevents Javadoc compilation errors with generic types. The feedback suggests a minor improvement to use the current context reference {{{.}}} instead of {{{returnType}}} inside the returnType block to avoid unnecessary parent context lookups and maintain consistency.

* @param requestOptions {@link RequestOptions } Object to store additional HTTP headers such as idempotency-keys (optional)
{{#returnType}}
* @return {@link {{.}} }
* @return {{#returnContainer}}{@code {{{returnType}}} }{{/returnContainer}}{{^returnContainer}}{@link {{.}} }{{/returnContainer}}

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.

medium

Inside the {{#returnType}} block, the current context (.) is already the returnType string. It is more idiomatic and robust to use {{{.}}} instead of {{{returnType}}} to refer to the current context. This avoids unnecessary parent context lookup and maintains consistency with the fallback {@link {{.}} }.

    * @return {{#returnContainer}}{@code {{{.}}} }{{/returnContainer}}{{^returnContainer}}{@link {{.}} }{{/returnContainer}}

@sonarqubecloud

Copy link
Copy Markdown

@poojah-adyen
poojah-adyen enabled auto-merge July 20, 2026 13:15
@poojah-adyen
poojah-adyen added this pull request to the merge queue Jul 21, 2026
Merged via the queue into main with commit 5ff17f1 Jul 21, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Fix Indicates a bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants