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
  • #4651
Closed
Open
Issue created Nov 29, 2019 by Administrator@rootContributor

[BUG][Kotlin] required yet nullable schema properties are not optional in generated models

Created by: by-zhou

Description

Some schemas have required but nullable properties in our open API specification. These are mapped to non-optional in the generated models.

openapi-generator version

4.2.0

OpenAPI declaration file content or url
components:
  schemas:
Foo:
      type: object
      required: [name]
      nullable: false
      properties:
        name:
          type: string
          nullable: true
...
Command line used for generation
Steps to reproduce
Related issues/PRs

Similar issue in Java: https://github.com/OpenAPITools/openapi-generator/issues/4530

Suggest a fix/enhancement

Not sure if I miss something else. I think the only thing missing is a question mark at the very end of the template "data_class_req_var.mustache".

...{{#isNullable}}?{{/isNullable}}
Assignee
Assign to
Time tracking