Skip to content

Supply required fields as args to builder() #24

@ThomasAlban

Description

@ThomasAlban

I'd love to have the option to supply required fields of a struct as args to the first method call (basically deriving a new method), leaving optional ones as separate methods you would then be able to call. This would also mean you should't have to call .build() at the end of the chain, because the data structure is valid 'from the get-go'. This would be great, as currently I use derive-new for when I have a simple struct and can't be bothered to write the new function, but having this built into bon would be much nicer as setters for optional methods would be derived too.

A note for the community from the maintainers

Please vote on this issue by adding a 👍 reaction to help the maintainers with prioritizing it. You may add a comment describing your real use case related to this issue for us to better understand the problem domain.

Metadata

Metadata

Assignees

No one assigned

    Labels

    design neededThe feature requires more design effortfeature requestA new feature is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions