swagger-api / swagger-api/swagger-codegen

Typescript: Schema "Error" is renamed to ModelError and not referenced in the types

Open
#12,166 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Description

In the schemas exists a type error:

    /**
     * The name of the error.
     * @type {string}
     * @memberof ModelError
     */
    type?: string;
    /**
     * A human-readable description of the problem.
     * @type {string}
     * @memberof ModelError
     */
    description?: string;
}

but renamed to

export interface ModelError {
    /**
     * The name of the error.
     * @type {string}
     * @memberof ModelError
     */
    type?: string;
    /**
     * A human-readable description of the problem.
     * @type {string}
     * @memberof ModelError
     */
    description?: string;
}

and never used instead Error stays at other schemas an referencing ES Error

Swagger-codegen version

3.0.44

Command line used for generation

Swagger online editor

Steps to reproduce

Use a swagger schema declaration name it error and generate a typescript axios client

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named in the issue. Reproduce the case in the Swagger online editor by declaring a schema named Error and generating a TypeScript Axios client; inspect the generated type declarations and references. Done means the generated client consistently uses the intended error type without incorrectly resolving to the built-in Error type.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.