Spring Data REST: non-exported association schemas renamed to <Name>Response since 3.1.1 (breaking), applied inconsistently
Mantenedores costumam responder em até 1 dia
@wn1331 já está trabalhando nisso.
Desde 11/11/2026.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 30/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- java, kotlin, openapi, spring-boot
- Domínio
- backend-api-design
Direção de pesquisa
Start with SpringDocDataRestUtils.updateResponseSchemaProperty and the entityInoMap lookup keyed by getSimpleName(), as introduced by PR #3334. Reproduce with an entity that has a non-exported repository, comparing a Set association, a nullable single association, and a non-null single association in the generated /v3/api-docs. Done means the naming rule is consistent across those shapes and @Schema(name) is honoured, which first requires agreeing on the intended behaviour with maintainers.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
Describe the bug
After upgrading springdoc-openapi-starter-webmvc-ui from 3.0.2 to 3.1.1 (still present in 3.2.0), component schemas for entities that are not exported repositories are renamed. For example, CustomerRelationship becomes CustomerRelationshipResponse in the generated spec. This changes generated client type names in a minor release.
This comes from #3334 (fix for #3136), which makes SpringDocDataRestUtils.updateResponseSchemaProperty rewrite such association properties to a <Name>Response copy. The filtering itself makes sense, but the side effects are surprising:
-
Breaking rename in a minor version. Nothing in #3334 or the release notes mentions that schema names change.
-
Inconsistent behaviour. Only two property shapes are rewritten: a direct
$refanditems(collections).Set<CustomerRelationship>is rewritten, so the spec containsCustomerRelationshipResponse.- A nullable single association (
var region: CustomerRegion?) is emitted in OpenAPI 3.1 asoneOf: [{$ref: CustomerRegion}, {type: null}]. It is skipped, so the plainCustomerRegionstays. - A non-null single association (
CustomerRegion) is rewritten toCustomerRegionResponse.
Similar relations therefore get different names depending on cardinality and nullability.
-
@Schema(name)is only honoured if it differs from the class name.entityInoMapis keyed bydomainType.getSimpleName()and looked up with the schema name.@Schema(name = "CustomerRelationship")onCustomerRelationshipis ignored and the suffix is still added.@Schema(name = "Foo")works because the lookup misses and no copy is created.
To Reproduce
- Spring Boot 4.x,
spring-boot-starter-data-rest, springdoc 3.1.1 or 3.2.0, OpenAPI 3.1. - Entity
Customerwith:@OneToMany(fetch = FetchType.LAZY) var relationships: Set<CustomerRelationship> = emptySet() @ManyToOne(fetch = FetchType.LAZY) var region: CustomerRegion? = nullCustomerRelationshipandCustomerRegionare entities with no exported repository. - Compare
/v3/api-docson 3.0.2 and 3.1.1:- 3.0.2:
#/components/schemas/CustomerRelationship - 3.1.1+:
#/components/schemas/CustomerRelationshipResponse;regionstill referencesCustomerRegion.
- 3.0.2:
Expected behavior
- Schema names stay stable across a minor upgrade, or the change is documented as breaking.
- Handling is consistent for collections, nullable singles (
oneOf/allOfwrappers), and non-null singles. - An explicit
@Schema(name = …)is respected even when it equals the class name, or the suffix is configurable (for example a property to disable the rename).
Workaround
Customize the generated schemas yourself to rename or strip the suffix, or use a @Schema(name) that differs from the class name.
- Linguagem predominante
- Java
- Estrelas
- 3.7k
- Forks
- 605
- Merge médio
- 2d 11h
- PRs com merge (30d)
- 17
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de springdoc/springdoc-openapi
-
MCP: OpenApiSchemaConverter drops types from OpenAPI 3.1 type arraysTalvez já em andamento @mariodavid assumiu há 3 dias. Aberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 30/100
springdoc/springdoc-openapi#3427 ·
Mantenedores costumam responder em até 1 dia
-
enhancement upstream
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
springdoc/springdoc-openapi#3324 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
enhancement upstream
Dificuldade 3/5 1-2 dias Facilidade para iniciantes 55/100
springdoc/springdoc-openapi#3309 · 4 comentários · 1 reação ·
Mantenedores costumam responder em até 1 dia
Todas as issues de springdoc/springdoc-openapi
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
line/centraldogma#1397 ·
Mantenedores costumam responder em até 2 dias
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
vert-x3/vertx-mail-client#268 ·
-
Startup can freeze while MigLayout's component wrapper runs its static initializer on the EDTAbertadesktop edt not responding
Dificuldade 1/5 1-3 horas Facilidade para iniciantes 86/100
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 88/100
Mantenedores costumam responder em até 1 dia
-
physical
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 74/100
antonyrag/ragleap-core#1339 ·