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
  • #3600
Closed
Open
Issue created Aug 09, 2019 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][jaxrs-spec] Generated code is not valid with additionalProperties

Created by: trajano

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

Generated code is not valid. A schema that has additional properties generates

private @Valid LocalizedString name = new java.util.HashMap<>();

Which is not valid it should've been

private @Valid LocalizedString name = new LocalizedString();
openapi-generator version

4.0.3

OpenAPI declaration file content or url
    LocalizedString:
      description: |
        An object containing all the translations for a given object.  Each key represents an
        [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tag.
      type: object
      title: Localized String
      properties:
        "und":
          description: Represents `und`etermined which is used as the default when a more specialized version is not available.
          type: string
      additionalProperties:
        x-additionalPropertiesName: language-tag
        description: |
          The key represents the [IETF BCP 47](https://tools.ietf.org/html/bcp47) language tag for clients to determine
           what string to display.
        type: string
      example:
        "und": "default locale"
        "en": "English"
        "en-CA": "Canadian English"
        "en-US": "US English"
        "zh": "Chinese"
        "zh-CN": "China Chinese (Simplified)"
Command line used for generation
            <plugin>
                <groupId>org.openapitools</groupId>
                <artifactId>openapi-generator-maven-plugin</artifactId>
                <version>4.0.3</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <configOptions>
                                <apiPackage>com.devhaus.dlm.api</apiPackage>
                                <booleanGetterPrefix>is</booleanGetterPrefix>
                                <dateLibrary>java8</dateLibrary>
                                <fullJavaUtil>true</fullJavaUtil>
                                <invokerPackage>com.devhaus.dlm.api</invokerPackage>
                                <java8>true</java8>
                                <modelPackage>com.devhaus.dlm.api.model</modelPackage>
                                <useSwaggerAnnotations>false</useSwaggerAnnotations>
                            </configOptions>
                            <generatorName>jaxrs-spec</generatorName>
                            <inputSpec>${project.basedir}/src/main/resources/openapi.yml</inputSpec>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
Steps to reproduce
Related issues/PRs

https://github.com/OpenAPITools/openapi-generator/issues/3388

Suggest a fix
Assignee
Assign to
Time tracking