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

[BUG] Values of instantiationTypes not considered

Created by: Marvin1912

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
openApiGenerate {
    generatorName = 'spring'
    outputDir = "${buildDir}/..."
    inputSpec = "${projectDir}/..."
    apiPackage = "com..."
    invokerPackage = "com..."
    modelPackage = "com..."
    instantiationTypes = [array: "java.util.HashSet"]    
    configOptions = [
            dateLibrary  : "java8",
            interfaceOnly: "true"
    ]
}
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used? 4.0.1 (org.openapitools:openapi-generator-gradle-plugin:4.0.1)
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output? Given instantiationTypes = [array: "java.util.HashSet"] Actual: ArrayLists are generated Expected: Generated HashSets
Description

Wanted to generate HashSets instead of ArrayLists for arrays and set value for instantiationTypes to [array: "java.util.HashSet"]. According to answer of Slack:

Jeremie Bresson vor 16 Stunden @Marvin please create an issue for that, it seems to me that the default value is hard-coded and not using this instantiationTypes parameter. See: https://github.com/OpenAPITools/openapi-generator/blob/4575b3074ab6f2628837ca84ed5c287f2afaceee/modules/openapi-generator/src/main/java/org/openapitools/codegen/languages/AbstractJavaCodegen.java#L718-L727

openapi-generator version

4.0.1, not a regression

OpenAPI declaration file content or url
openApiGenerate {
    generatorName = 'spring'
    outputDir = "${buildDir}/..."
    inputSpec = "${projectDir}/..."
    apiPackage = "com..."
    invokerPackage = "com..."
    modelPackage = "com..."
    instantiationTypes = [array: "java.util.HashSet"]    
    configOptions = [
            dateLibrary  : "java8",
            interfaceOnly: "true"
    ]
}
Command line used for generation

gradle clean openApiGenerate

Steps to reproduce

Just set instantiationTypes according to example above.

Related issues/PRs
Suggest a fix
Assignee
Assign to
Time tracking