Skip to content

[BUG][JAVA] When using java and library native I get syntax error #22304

@MoonWalkerAZ

Description

@MoonWalkerAZ

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When trying to generate .java files from Unleash OpenAPI specs (file attached), I get errors using OpenAPI Generator with java native library. It seems that it generates the method names that are not valid for Java syntax. I use java native because I want the client to be java.net.http.HttpClient.

Command I use:
openapi-generator generate -i unleash.openapi.json -g java -o test --additional-properties=serializationLibrary=jackson,library=native

Example error I get when I try to compile the code:

.../AdvancedPlaygroundRequestSchemaProjects.java:228: error: unexpected token: <
    public List<String> getList<String>() throws ClassCastException {
                               ^

Multiple files have this issue.

openapi-generator version

7.17.0

OpenAPI declaration file content or url

unleash.openapi.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions