-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Open
Labels
Description
Description of the problem/issue
Generating open-api for kotlin code using jakarta, eg. using swagger-maven-plugin-jakarta:
- When a field type is a kotlin inline class, the field name is mangled in the generated open-api spec.
The class in question (inline of String) works fine with Jackson, but Swagger does not understand it.
Affected Version
2.2.36
Confirmed in 2.2.22
Probably been there forever
Steps to Reproduce
- In a Spring Boot app using Jakarta/Jersey (might not be relevant, but that is where it was observed):
@JvmInline
value class BankRegistryNumber(val asString: String) {
override fun toString(): String = asString
}
class TestRequest(
val customer: String,
val bank: BankRegistryNumber,
)
@Controller
@Path("/test")
class TestResource() {
@POST
@Path("/test")
fun test(
@RequestBody req: TestRequest,
): Response {
return accepted().build()
}
}
- Generate open-api, e.g. using swagger-maven-plugin-jakarta
Expected Behavior
shema for TestRequest is
{
"customer": "string",
"bank": "string"
}
Actual Behavior
shema for TestRequest is
{
"customer": "string",
"bank-4FVcRo8": "string"
}
Checklist
- I have searched the existing issues and this is not a duplicate.
- I have provided sufficient information for maintainers to reproduce the issue.