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
  • #13196
Closed
Open
Issue created Aug 16, 2022 by Administrator@rootContributor

[BUG][JAVA] required on component only set on the getter of the model

Created by: wvtbg

We have a post method with a component as body. This component has required field but sending a post with missing elements is allowed with the current generated code. openapi yaml : ... paths: /events: post: tags: - Event Data operationId: createEvent requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/event' ... components: schemas: event: title: event description: event type: object required: - eventName properties: eventName: type: string

pom.xml ... org.openapitools openapi-generator-maven-plugin 6.0.1 spring-boot-api generate spring true true true false spring-boot ...

event class generated : ... @JsonProperty("eventName") private String eventName; ... @NotNull @Schema(name = "eventName", required = true) public String getEventName() { return eventName; }

public void setEventName(String eventName) { this.eventName = eventName; }

--

We expect the @NotNull on the setter to or even on the Property. Now we can call the create without any content in the body except '{}'

Assignee
Assign to
Time tracking