Skip to content

[BUG][typescript-axios] Broken client #9036

@vmstarchenko

Description

@vmstarchenko

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • Have you tested with the latest master to confirm the issue still exists?
  • Have you searched for related issues/PRs?
  • What's the actual output vs expected output?
Description

openapi-generator create broken client for attached schema.
Errors:

  • Types error:
  > 75 |         apiProblemCreate: async (tags: Array<ProblemTagRequest>, options: any = {}): Promise<RequestArgs> => {
       |                                              ^ // ProblemTagRequest does not exist
    76 |             // verify required parameter 'tags' is not null or undefined
    77 |             assertParamExists('apiProblemCreate', 'tags', tags)
    78 |             const localVarPath = `/api/problem/`;
  • DataForm usage error
92 |  localVarFormParams.append(tags.join(COLLECTION_FORMATS.csv));
                               ^ // here should be append('tags', tags...
  • wrong array usage
92 |    localVarFormParams.append(tags.join(COLLECTION_FORMATS.csv));
                                         ^ // join returns [object Object],[object Object],
openapi-generator version

5.0.1
latest dev version

OpenAPI declaration schema

https://gist.github.com/vmstarchenko/9671d45499a66d73b6746e69168c6cc5

Generation Details
java -jar ./openapi-generator-5.0.1/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate -i ./api-spec.yaml -g typescript-axios --additional-properties=useSingleRequestParameter=true -o ./client/typescript-axios

Generated client:
https://gist.github.com/vmstarchenko/5128a715559fcb065649b37b316f3be9

Steps to reproduce

Generate typescript-axios client with useSingleRequestParameter additional property and attached schema

Related issues/PRs
Suggest a fix

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