Skip to content

Request Object Parameter is no longer required after upgrade to 3.0.0 #3172

@karenmillermoj

Description

@karenmillermoj

Describe the bug

After upgrading from 2.8.14 to 3.0.0, Kotlin data class request object parameters that were previously correctly marked as required are no longer mandatory.

To Reproduce
Steps to reproduce the behavior:

What version of spring-boot you are using?
4.0.0
What modules and versions of springdoc-openapi are you using?
springdoc-openapi-starter-webmvc-ui:3.0.0

Provide with a sample code (HelloController) or Test that reproduces the problem

Controller

import org.springframework.web.bind.annotation.GetMapping
import org.springframework.web.bind.annotation.RestController

@RestController
class HelloController {

  @GetMapping("/hello")
  fun getFoo(tester: Tester): String = "Ok"
}

data class Tester(
  val strOne: String,
)

Expected behavior

      "Tester": {
        "type": "object",
        "properties": {
          "strOne": {
            "type": "string"
          }
        },
        "required": [
          "strOne"
        ]
      },

Actual behavior

      "Tester": {
        "type": "object",
        "properties": {
          "strOne": {
            "type": "string"
          }
        }
      },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions