Skip to content
GitLab
    • Explore Projects Groups Snippets
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
  • #12948
Something went wrong while setting issue due date.
Closed
Open
Issue created 3 years ago by Administrator@rootContributor5 of 6 checklist items completed5/6 checklist items
  • New related issue

  • Report abuse to administrator

  • New related issue

  • Report abuse to administrator

[BUG][typescript-fetch] Compile error when using "noImplicitOverride" in tsconfig

Closed

[BUG][typescript-fetch] Compile error when using "noImplicitOverride" in tsconfig

Created by: douniii

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?
  • [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description

When compiling the generated code with a tsconfig where "noImplicitOverride": true (see here) is set, the compiler complains about the not marked overrides: This member must have an 'override' modifier because it overrides a member in the base class 'Error'.

openapi-generator version

6.0.1 (and master) by using "@openapitools/openapi-generator-cli": "2.5.1"

OpenAPI declaration file content or url

N/A

Generation Details
openapi-generator-cli generate -i ./openapi.json -g typescript-fetch -o src/generated-sources/openapi --additional-properties=supportsES6=true,npmVersion=8.6.0,typescriptThreePlus=true
Steps to reproduce

Checkout https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/typescript-fetch/builds/es6-target and add to the tsconfig "noImplicitOverride": true,.

{
  "compilerOptions": {
    "noImplicitOverride": true,
    "declaration": true,
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "outDir": "dist",
    "typeRoots": [
      "node_modules/@types"
    ]
  },
  "exclude": [
    "dist",
    "node_modules"
  ]
}

and build it.

Related issues/PRs
Suggest a fix

Place "override" before overridding props/methods here https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L222 https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L229 https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L230 https://github.com/OpenAPITools/openapi-generator/blob/6d44f97d6cc4bcd11752ca6556075232dc4e5fdb/modules/openapi-generator/src/main/resources/typescript-fetch/runtime.mustache#L236

  1. Oh no!

    You are trying to upload something other than an image. Please upload a .png, .jpg, .jpeg, .gif, .bmp, .tiff or .ico.

    Incoming!

    Drop your designs to start your upload.
Tasks
0
server returned results with length 1, expected length of 9

Linked items
0

Link issues together to show that they're related. Learn more.

Activity


  • Administrator
    Administrator @root · 2 years ago
    Author Contributor

    Created by: cre8

    I am still getting the error with version 6.1.0:

    export class RequiredError extends Error {
        name: "RequiredError" = "RequiredError";
        constructor(public field: string, msg?: string) {
            super(msg);
        }
    }

    here the name attribute gets overwritten ...

  • Administrator
    Administrator @root · 2 years ago
    Author Contributor

    Created by: macjohnny

    @cre8 do you want to fix this?

  • Administrator
    Administrator @root · 2 years ago
    Author Contributor

    Created by: cre8

    @macjohnny I can spend some time to dig deeper since you already made a merge that added the override part.

    I am using the typescript-axios one to generate it. Have you checked this when updating the code, it's not metioned in the merge?

    Thinks it is this peace of code: https://github.com/OpenAPITools/openapi-generator/blob/755359c031cadd5995e5e22fdb13938f3024c540/modules/openapi-generator/src/main/resources/typescript-axios/baseApi.mustache#L56

Please register or sign in to reply
0 Assignees
None
Assign to
Labels
0
None
0
None
    Assign labels
  • Manage project labels

Milestone
No milestone
None
Due date
None
None
None
Time tracking
No estimate or time spent
Confidentiality
Not confidential
Not confidential

You are going to turn on confidentiality. Only project members with at least the Reporter role, the author, and assignees can view or be notified about this issue.

Lock issue
Unlocked
0
0 participants
Reference:

Menu

Explore Projects Groups Snippets