Skip to content

[General] refactor the type-mapping logic to clearly separate build-in types from API-defined types #5027

@ePaul

Description

@ePaul

Swagger Codegen has some logic which selects type names for generated models and for properties.
This handles both mapping to build-in types of the programming language (e.g. for Java int/double/String/BigDecimal/UUID/...) and name conversion (e.g. case change, escaping for reserved words, model name prefix/suffix) for types defined in the API definition file (mainly object and enum types).

Currently the code is a bit convoluted, which leads to bugs like #3678 (where the suffix/prefix is applied to a build-in type).

Solution proposal

This logic needs to be refactored to separate both functions clearly. Any name modifications should only be applied to for API defined types, not to build-in types of the programming language.
(I guess handling of maps/lists would also be part of this.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions