Describe the bug
After the upgrade from springdoc 3.0.2 to 3.0.3 we've noticed that
@field:Schema(description = "The object of the person to greet")
val objectName: SomeObject? = null,
gets generated as
"objectName" : {
"oneOf" : [ {
"$ref" : "#/components/schemas/SomeObject"
}, {
"type" : "null"
} ]
}
and the description is then not set at all.
Under springdoc 3.0.2 the same code generated:
"objectName" : {
"$ref" : "#/components/schemas/SomeObject",
"description" : "The object of the person to greet"
}
To Reproduce
- What version of spring-boot you are using? 4.0.5
- What version of kotlin are you using? 2.3.20
- What modules and versions of springdoc-openapi are you using? 3.0.3
- What is the actual and the expected result using OpenAPI Description (yml or json)? See above for actual and also the generated code in 3.0.2. I would expect the
description to be still set.
- Provide with a sample code (HelloController) or Test that reproduces the problem
@RestController
class IssuesController {
@GetMapping("/")
fun greet(greeting: Greeting): String = greeting.objectName?.toString() ?: "Hello World"
}
data class Greeting(
@field:Schema(description = "The object of the person to greet")
val objectName: SomeObject? = null,
)
data class SomeObject(val someProperty: String)
Expected behavior
The description is generated and not missing.
Note that if the field is defined as
val stringName: String? = null,
then the generated code is
"stringName" : {
"type" : [ "string", "null" ],
"description" : "The name of the person to greet"
},
Describe the bug
After the upgrade from springdoc 3.0.2 to 3.0.3 we've noticed that
gets generated as
and the
descriptionis then not set at all.Under springdoc 3.0.2 the same code generated:
To Reproduce
descriptionto be still set.Expected behavior
The
descriptionis generated and not missing.Note that if the field is defined as
then the generated code is