Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #2935
Closed
Open
Issue created May 19, 2019 by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items

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

Created by: 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
Assignee
Assign to
Time tracking