Skip to content

Schema annotations break when applied to a Boolean field (Kotlin) #2229

@cannonrush

Description

@cannonrush

Describe the bug
Schema annotations with field use-site break when applied to a Boolean field named ^is.*$

To Reproduce
Demo application:

@Configuration
@OpenAPIDefinition(info = Info(title = "Demo Application", version = "0.0.1"))
open class OpenApiConfiguration

@RestController
@RequestMapping("/api")
class HelloController {
    @GetMapping("/schema")
    fun getSchemaResponse(): Response = Response()
}

@Schema(description = "Demo response object")
data class Response(
    @field:Schema(description = "My boolean field description", example = "false")
    val isMyBoolean: Boolean = false
)

Expected output

components:
  schemas:
    Response:
      type: object
      properties:
        myBoolean:
          type: boolean
          description: My boolean field description
          example: false
      description: Demo response object

Actual output

components:
  schemas:
    Response:
      type: object
      properties:
        myBoolean:
          type: boolean
      description: Demo response object

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