Skip to content

Generated client with typescript-fetch generator is very different from swagger-codegen-2.2.3 #347

Closed
@megaboich

Description

@megaboich

The problem: When using latest openapi-generator there is a lot of differences in generated client codebase.

We have quite a big code base generated automatically using swagger-codegen-2.2.3. There are some 35 of different REST controllers and we have build automation script that generates typescript-fetch API clients for them during the build process and in general it works very well and everyone is happy.

But I think in version 3 of swagger codegen there were introduced lots of changes.
The most annoying change is switching from object-structured parameters to plain parameters.
Compare this code which invokes generated api:
Before

    await this.api.getWorkspacePermissions({
        authorization: this.apiHelper.authToken,
        workspaceId: workspaceId
    })

After

    await this.api.getWorkspacePermissions(this.apiHelper.authToken, workspaceId)

I do not like that names of parameters are not presented now. In some cases we have lots of string parameters and here I see several disadvantages in this approach:

  1. When I do not see the names then it is not readable anymore.
  2. Error could be easily added when I put them in wrong order.
  3. Also if someone at backend decide to change parameter name and order (like remove something called projectId and add different required parameter called parentObjectId) then new generated client will still be compatible because there is just a bunch of string parameters in API call without information about the name.

Any ideas why this change was introduced? Probably I just do not see the benefits from it?

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