micronaut-projects / micronaut-openapi

Generates OpenAPI / Swagger Documentation for Micronaut projects
https://micronaut-projects.github.io/micronaut-openapi/latest/guide/index.html
Apache License 2.0
80 stars 95 forks source link

Generated spec contains only one Schema if multiple Schema.name="xy" exist #1698

Closed ideadapt closed 2 months ago

ideadapt commented 3 months ago

Feature description

Consider this situation

@Schema(name="Car")
data class Car1(val p1: String)

@Schema(name="Car")
data class Car2(val p2: String)

This will today generate a single Car schema in the openapi spec (while it seems not deterministic which of both types will be used). So one type is missing in the spec. The generated spec is valid and the generator process finishes with status ok, without any hint that some Schemas were overridden.

A similar issue was solved with #947 . But that fix only considers the name of the type and not the annotated Schema.name override.

It would be good to either: