Skip to content

[REQ] Alternative means for deriving api parameter names #12482

@rsdouglas

Description

@rsdouglas

Is your feature request related to a problem? Please describe.

We have an endpoint that takes in a json object in the body which can be one of about 20 different types. This is expressed with anyOf in our spec. We are using the typescript-axios generator. The generated code is functional, but the functions in ApiAxiosParamCreator have parameters with crazy long names (500+ characters - all of the possible types in the union concatented).

Describe the solution you'd like

I'd like to implement some sort of alternative means of generating these parameter names (assuming this feature doesn't exist). Specifically I'd to be able to set a flag to base the parameter name on whatever substring is common across all types in the union. In our case the endpoint deals with specific operations, e.g. AddOperation, SubtractOperation (obviously not this trivial). In this case the generated parameter name might be "operation"

Describe alternatives you've considered

We've tried alternative ways of specifying the input parameter type in the spec (e.g. using an abstract class + discriminator) but we don't want to change the spec for the sake of altering the generated code.

Additional context

I'm not sure if this should be considered a feature or a bug. Having parameters names in excess of 500 characters seems like it could be considered a bug.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions