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
  • #191
Closed
Open
Issue created May 31, 2018 by Administrator@rootContributor

String/Boolean map using additionalProperties is not generated

Created by: JFCote

Description

I have a simple object declared like this:

StringBooleanMap:
      additionalProperties:
          type: boolean

It was used in another model:

  GetFrontEndPermissionsResponse:
    type: object
    required:
      - meta
    properties:
      meta:
        $ref: "#/definitions/ResponseMeta"
      data:
        $ref: "#/definitions/StringBooleanMap"

With swagger-codegen, it was simply generated and used in the models needing it. It was looking like that when used in a model:

@JsonProperty("data")
  private StringBooleanMap data = null;

With openapi-generator, it is not generated at all. Instead, it simply generate a "map" with no type.

@JsonProperty("data")
  private Map data = null;

This is a very bad regression since we cannot validate that the map really is a String/Boolean, we lose type safety.

openapi-generator version

Latest master

Command line used for generation

java -jar openapi-generator-cli.jar generate -i swagger.yaml --generator-name java-play-framework -o generatedServer -DhideGenerationTimestamp=true

Steps to reproduce

Just run the above command line and make sure you have and object using the StringBooleanMap object in one of its property.

Related issues/PRs

I think it is related to https://github.com/OpenAPITools/openapi-generator/issues/185

Suggest a fix/enhancement

I think if we don't want to lose all the current swagger-codegen users that would want to switch, we need to generate stuff that was previously generated and it just make sense. If I create a model and that this model is referenced somewhere else, we should generate it "as is". Converting it to "basic type" is a very dangerous assumption that do not follow the spec in my opinion. And as I said earlier, this break type safety when dealing with collection (Map in this case)

Assignee
Assign to
Time tracking