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
  • #11165
Closed
Open
Issue created Dec 21, 2021 by Administrator@rootContributor

[BUG][Java Spring OAS3] Request body is not mapped anymore

Created by: whydoievenneedthis

Description

The request body is no longer mapped, the bean on the receiving end is empty.

openapi-generator version

5.3.1

Generation Details

Generator name: spring Config options: oas3 = true

Generated code

The following method is generated:

ResponseEntity<Response> create(
@Parameter(name = "", required = true )   @Valid @RequestBody Request request);

The problem is, it also has the following imports:

import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.web.bind.annotation.*;

The org.springframework.web.bind.annotation.RequestBody annotation is being suppressed by the oas one, and as a result, spring doesn't do any request body mapping here.

How to solve it

I don't see a place in any of the mustache files where the oas RequestBody would be used, so it's probably safe to simply drop it from api.mustache. If not, then use the fully qualified class name in bodyParams.mustache. If both of them were inteded to be used here, add the fully qualified annotations for both, just so the intent is explicit.

Assignee
Assign to
Time tracking