Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #9789
Closed
Open
Issue created Jun 16, 2021 by Administrator@rootContributor

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

Created by: 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?

Assignee
Assign to
Time tracking