Skip to content

[Bug] Newline in x-deprecatedMessage breaks generated @Deprecated annotation #1864

Description

@gcatanese

Context

In templates-v7/libraries/jersey3/pojo.mustache, the x-deprecatedMessage vendor extension is used to generate inline @Deprecated annotations with the deprecation message appended as a single-line comment:

@Deprecated // deprecated since Adyen Checkout API v50: - If your version is between 50 and 69, use `threeDSAuthenticationOnly` instead.
- If your version is 70 or later, use `authenticationData.authenticationOnly` instead.

When the x-deprecatedMessage value in the OpenAPI spec contains newline characters, the generated code breaks: the continuation of the message is placed outside the // comment, resulting in invalid Java syntax. This is visible in ThreeDS2RequestFields.java around lines 186–187.

Proposed Change

The @Deprecated annotation in pojo.mustache should not include the deprecation message as a single-line comment, since single-line comments cannot span multiple lines. The deprecation message is already safely included in the Javadoc block via the @deprecated tag (inside /** */), where multi-line content is handled correctly.

Change occurrences like:

@Deprecated // deprecated ...: {{{.}}}

to simply:

@Deprecated

Benefit

Prevents invalid Java code from being generated when x-deprecatedMessage contains newline characters, while preserving the deprecation message in the Javadoc where it is safe and visible to IDEs and tooling.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bug reportIndicates that issue has been marked as a possible bug by its creator

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions