Skip to content

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

@colorcube

Description

@colorcube
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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions