Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #5533
Closed
Open
Issue created Mar 05, 2020 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

[BUG][JAVA] additionalModelTypeAnnotations value is escaped

Created by: gdrouet

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The annotations specified with additionalModelTypeAnnotations are escaped. Thefore, using a special character like = leads to a compilation error.

openapi-generator version

4.2.x

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/blob/master/modules/openapi-generator-maven-plugin/examples/multi-module/sample-schema/src/main/resources/openapi.yaml

            <!-- activate the plugin -->
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>4.3.0-SNAPSHOT</version>
                <dependencies>
                    <dependency>
                        <groupId>${project.groupId}</groupId>
                        <artifactId>sample-schema</artifactId>
                        <version>${project.parent.version}</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <inputSpec>openapi.yaml</inputSpec>
                            <generatorName>java</generatorName>
                            <configOptions>
                                <additionalModelTypeAnnotations>@Foo(val=true)</additionalModelTypeAnnotations>
                            </configOptions>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
Command line used for generation

Just run the maven plugin.

Steps to reproduce

Inside additionalModelTypeAnnotations, add a value with any special character like @Foo(val=true).

Compilation will fail becaise the annotation is written like this: @Foo(val&#x3D;true)

Suggest a fix

Do not escape the value inside the template.

Assignee
Assign to
Time tracking