You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support a class name suffix/prefix that applies only to generated beans #518
area/beansIssues related to generating java beans for types.area/jaxrsIssues related to generation of JAX-RS interface.type/enhancementIssues that represent requests for new features.
JaxRsProjectSettings exposes classNamePrefix and classNameSuffix. Both are applied in CodegenUtil.toClassName(...), which is used for generated beans and for the generated JAX-RS
interfaces (OpenApi2JaxRs lines 344 and 543).
So setting classNameSuffix = "Dto" produces PetDto, but also PetResourceDto.
Use case
Reported downstream in quarkiverse/quarkus-openapi-generator#1724: generated models are DTOs and
live next to hand-written domain classes with the same simple names. A suffix on the models only
(Pet -> PetDto) avoids the clash, while the JAX-RS interfaces should keep their names
(PetResource).
Proposal
Add bean-only settings to JaxRsProjectSettings, for example:
and apply them wherever a bean class name is resolved:
OpenApi2JaxRs#generateJavaBean (bean name and the $ref lookup in the SchemaStore)
CodegenUtil#schemaRefToFQCN (types referenced from interfaces and other beans)
Interface names would keep using only classNamePrefix / classNameSuffix.
To stay backwards compatible, the new settings would be combined with the existing ones for beans
(empty by default, so current output does not change).
Open question
Should the model suffix be added on top of classNameSuffix for beans, or replace it?
area/beansIssues related to generating java beans for types.area/jaxrsIssues related to generation of JAX-RS interface.type/enhancementIssues that represent requests for new features.
Activity