Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript code generation for OpenApi 3 has no post parameter (requestBody) in 3.0.0 branch #7331

Open
colorcube opened this issue Jan 7, 2018 · 6 comments

Comments

@colorcube
Copy link

Description

the generated code has no post parameter

Swagger-codegen version

v 3

Swagger declaration file content or url

OpenApi 3 excerpt

paths:
  /login:
    post:
      requestBody:
        description: The email/password
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Login'

generated code excerpt

  public loginPost(observe?: 'body', reportProgress?: boolean): Observable<LoginUser>;
  public loginPost(observe?: 'response', reportProgress?: boolean): Observable<HttpResponse<LoginUser>>;
  public loginPost(observe?: 'events', reportProgress?: boolean): Observable<HttpEvent<LoginUser>>;
  public loginPost(observe: any = 'body', reportProgress: boolean = false): Observable<any> {

    let headers = this.defaultHeaders;

    // to determine the Accept header
    let httpHeaderAccepts: string[] = [
      'application/json'
    ];
    let httpHeaderAcceptSelected: string | undefined = this.configuration.selectHeaderAccept(httpHeaderAccepts);
    if (httpHeaderAcceptSelected != undefined) {
      headers = headers.set("Accept", httpHeaderAcceptSelected);
    }

    // to determine the Content-Type header
    let consumes: string[] = [
      'application/json'
    ];

    return this.httpClient.post<LoginUser>(`${this.basePath}/login`,
      null, // HERE is something missing
      {
        withCredentials: this.configuration.withCredentials,
        headers: headers,
        observe: observe,
        reportProgress: reportProgress
      }
    );
  }

Search for '// HERE is something missing'

Command line used for generation

java -jar swagger-codegen-cli-3.0.0-20180106.033640-15.jar generate -i api.yaml -l typescript-angular -o ./client

@MBcom
Copy link

MBcom commented Dec 29, 2018

any update on this?

@artonge
Copy link

artonge commented Apr 2, 2019

This needs a fix, the client is unusable right now...

@micaelboucard
Copy link

Yes me too, I need to run a postprocessing script to fix this among other issues.
Any updates on this fix?

@HugoMario
Copy link
Contributor

HugoMario commented Apr 4, 2019 via email

@RaduFurnea
Copy link

RaduFurnea commented Apr 11, 2019

Using this generator , the problem seems to be solved

image

@rosbly
Copy link

rosbly commented Apr 6, 2023

Indeed this bug makes this generator unusable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants