Skip to content

[BUG][typescript-fetch] HEAD missing in HTTPMethod for typescript-fetch client #2935

@yuannnh

Description

@yuannnh

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue? yes
  • Have you validated the input using an OpenAPI validator (example)? yes
  • What's the version of OpenAPI Generator used? 4.0.0
  • Have you search for related issues/PRs? yes
  • What's the actual output vs expected output?
    Expected output: Api run correctly.
    Actual output: TypeScript error: Type '"HEAD"' is not assignable to type 'HTTPMethod'
  • [Optional] Bounty to sponsor the fix (example)
Description

While running generated API, I got
TypeScript error: Type '"HEAD"' is not assignable to type 'HTTPMethod'

After checking the generated API's code, I found that there is HEAD value missing in type HTTPMechod.

runtime.ts

export type HTTPMethod =
  | "GET"
  | "POST"
  | "PUT"
  | "PATCH"
  | "DELETE"
  | "OPTIONS";

However in BasicErrorControllerApi.ts, we do use the HEAD method:

 async errorUsingHEADRaw(): Promise<
    runtime.ApiResponse<{ [key: string]: object }>
  > {
    const queryParameters: runtime.HTTPQuery = {};

    const headerParameters: runtime.HTTPHeaders = {};

    const response = await this.request({
      path: `/error`,
      method: "HEAD",
      headers: headerParameters,
      query: queryParameters
    });

    return new runtime.JSONApiResponse<any>(response);
  }

It works well after adding HEAD in HTTPMethod.

openapi-generator version

typescript-fetch 4.0.0

OpenAPI declaration file content or url

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