[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}}