Skip to content

Option for not setting null as default value for non-required fields #24

Open
@jostl

Description

@jostl

Hi. When code is generated from properties which are non-required, the default value is automatically set to null. I would like to not generate any default value for these fields. Is there a way to do this? If not, is there a possibility to add this functionality?

The practical problem for me is that when dealing with multiple models and mappers, the default value allows for making mistakes more easily when writing the mappers.

Example:

Generated code now:

data class Data(
    val otherField: String,
    val nonrequired: String? = null
)

But I would prefer:

data class Data(
    val otherField: String,
    val nonrequired: String?
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions