Skip to content

Support a class name suffix/prefix that applies only to generated beans #518

Backlog

Description

@matheusandre1

Context

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:

public String modelNamePrefix = "";
public String modelNameSuffix = "";

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?

I can send a PR if the approach sounds right.

Activity

  1. added
    type/enhancement
    area/beans
    area/jaxrs
    on Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/beansarea/jaxrstype/enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions