Skip to content

[REQ][spring] Required properties of a model should be made mandatory in constructor #9789

@mimkorn

Description

@mimkorn

Problem

The constructors of the generated models with the spring generator have no builders, empty constructors. The fact that a property is required is only in an annotation that I do not think has any other effect than informing the reader.

Describe the solution you'd like

IMHO there should be a constructor that would have all the required properties in it and no constructor without it. This way you'd enforce setting those up. Otherwise what stops you from sending responses from the server without required properties?

Describe alternatives you've considered

using lombok to create builders and constructors would be nice in general.

Is there some way generated server stub ensures adhering to the contract in the question of required attribute?

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