Skip to content

[BUG][Javascript] Constructors don't handle required fields with default values well #6648

@tray2100

Description

@tray2100
Description

Currently the generator creates constructors where required fields are set to the parameters in the constructor. This is fine except when the parameters are null and there is a default value specified in the spec.

openapi-generator version

4.3.1

Suggest a fix

This can be fixed by just having the constructor assign either the incoming value or the default value if the incoming value is undefined. I'll submit a PR for this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions