Skip to content

Unable to determine if it is a Kotlin type #2556

Closed
@mymx2

Description

@mymx2

Unable to determine if it is a Kotlin type

  • method: SpringDocKotlinConfiguration.nullableKotlinRequestParameterCustomizer
  • lineNum: 78
    image

To Reproduce
Steps to reproduce the behavior:

  • What version of spring-boot you are using?
    • 3.2.4
  • What modules and versions of springdoc-openapi are you using?
    • 2.4.0
  • What is the actual and the expected result using OpenAPI Description (yml or json)?
    • kotlin type isMarkedNullable
  • Provide with a sample code (HelloController) or Test that reproduces the problem
interface AdminSysNoticePage {

  @Operation(summary = "adminSysNoticePage", description = "adminSysNoticePage")
  @GetMapping("adminSysNoticePage")
  fun adminSysNoticePage(
    @Validated request: AdminSysNoticePageRequest
  ): AdminSysNoticePageResponse
}

@Schema(description = "AdminSysNoticePageRequest")
data class AdminSysNoticePageRequest(

  @field:Schema(description = "id not required", example = "")
  var id: Long? = null,

  @field:Schema(description = "noticeTitle is required", example = "")
  var noticeTitle: String,
)

@Schema(description = " AdminSysNoticePageResponse")
data class AdminSysNoticePageResponse(

  @field:Schema(description = "id is required", example = "")
  var id: Long,

  @field:Schema(description = "updateBy is not required", example = "")
  var updateBy: String? = null,
)

Screenshots

  • wrong: KotlinDetector.isKotlinType(methodParameter.parameterType)
    image

  • right: KotlinDetector.isKotlinType(methodParameter.containingClass)
    image

  • fix: KotlinDetector.isKotlinType(methodParameter.containingClass)
    image

is this fix code right?

Additional context
id dont know what fix use methodParameter.toKParameter() ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidThis doesn't seem right

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions