swagger-api / swagger-core

Examples and server integrations for generating the Swagger API Specification, which enables easy access to your REST API
http://swagger.io
Apache License 2.0
7.39k stars 2.19k forks source link

Can i controller schema order with same property? #4228

Open hqsz opened 2 years ago

hqsz commented 2 years ago

Is your feature request related to a problem? Please describe. I have below use case

  1. using replaceWithSchema at configuration

    init {
        SpringDocUtils
            .getConfig()
            .replaceWithSchema(
                UserId::class.java,
                Schema<UserId>().apply {
                    description = "default description"
                    type = "integer"
                }
            )
    }
    • because this type is so widely using, so i want to apply common schema by type
  2. but sometimes i need to override schema because it need more detail description

    data class TwoUserIds(
    val userId: UserId,
    @Schema(description = "detail description", type = "integer")
    val otherUserId: UserId
    )

but i couldn't find a way to control annotation processing order.

Describe the solution you'd like

hqsz commented 2 years ago

I asked same question at springdoc/springdoc-openapi#1757 but they said it is part of swagger-core 🙏