-
-
Notifications
You must be signed in to change notification settings - Fork 589
Parameter is no longer optional after upgrade to 2.8.8 #2978
Copy link
Copy link
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
After upgrading from 2.8.6 to 2.8.8, request parameters that were previously correctly marked as required: false are now marked as required: true
To Reproduce
Steps to reproduce the behavior:
- What version of spring-boot you are using?
- 3.4.5
- What modules and versions of springdoc-openapi are you using?
- springdoc-openapi-starter-webmvc-ui 2.8.8
- Provide with a sample code (HelloController) or Test that reproduces the problem
@ParameterObject
data class FooParameters(
@RequestParam(name = "bar", required = false, defaultValue = DEFAULT_BAR.toString())
@field:Parameter(schema = Schema(minimum = "1", type = "integer", defaultValue = DEFAULT_BAR.toString()))
@field:Min(1)
val bar: Int = DEFAULT_BAR,
@RequestParam(name = "baz", required = false, defaultValue = DEFAULT_BAZ.toString())
@field:Parameter(schema = Schema(minimum = "1", maximum = "200", type = "integer", defaultValue = DEFAULT_BAZ.toString()))
@field:Min(1)
@field:Max(200)
val baz: Int = DEFAULT_BAZ
) {
companion object {
const val DEFAULT_BAR = 1
const val DEFAULT_BAZ = 20
}
}
@RestController("/")
class FooController {
@GetMapping("/foo")
fun getFoo(@Valid fooParameters: FooParameters): String {
return "Ok"
}
}Expected behavior (in 2.8.6)
"parameters": [
{
"name": "bar",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 1,
"minimum": 1
}
},
{
"name": "baz",
"in": "query",
"required": false,
"schema": {
"type": "integer",
"default": 20,
"maximum": 200,
"minimum": 1
}
}
],Actual behavior (in 2.8.8)
"parameters": [
{
"name": "bar",
"in": "query",
"required": true,
"schema": {
"type": "integer",
"default": 1,
"minimum": 1
}
},
{
"name": "baz",
"in": "query",
"required": true,
"schema": {
"type": "integer",
"default": 20,
"maximum": 200,
"minimum": 1
}
}
]Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working