OpenAPITools / OpenAPITools/openapi-generator

[BUG] [typescript-fetch] method name conflicts xxxRaw

Open
#11,827 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue: Bug
Dominant language
Java
Stars
26.8k
Forks
7.7k
PR merge metrics
PR metrics pending

Description

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

https://try.gitea.io/swagger.v1.json

Provides method renderMarkdown and renderMarkdownRaw

renderMarkdown generate

  1. public method renderMarkdown()
  2. and public internal renderMarkdownRaw(), seems for internal use

renderMarkdownRaw generate

  1. public method renderMarkdownRaw()
  2. and public internal renderMarkdownRawRaw(), seems for internal use

Two renderMarkdownRaw() are not same

openapi-generator version
OpenAPI declaration file content or url

https://try.gitea.io/swagger.v1.json

Generation Details
Steps to reproduce
$ openapi-generator-cli generate -g typescript-fetch -i https://try.gitea.io/swagger.v1.json -o src
$ tsc --init
$ tsc --outDir dist
src/apis/MiscellaneousApi.ts(204,11): error TS2393: Duplicate function implementation.
src/apis/MiscellaneousApi.ts(312,11): error TS2393: Duplicate function implementation.
src/apis/index.ts(10,1): error TS2308: Module './RepositoryApi' has already exported a member named 'CreateCurrentUserRepoRequest'. Consider explicitly re-exporting to resolve the ambiguity.
src/runtime.ts(129,24): error TS2304: Cannot find name 'GlobalFetch'.
    /**
     * Render a markdown document as HTML
     */
    async renderMarkdownRaw(requestParameters: RenderMarkdownRequest, initOverrides?: RequestInit): Promise<runtime.ApiResponse<string>> {
        const queryParameters: any = {};

        const headerParameters: runtime.HTTPHeaders = {};

        headerParameters['Content-Type'] = 'application/json';

        // if (this.configuration && this.configuration.apiKey) {
        // ...
        // ... 

        return new runtime.TextApiResponse(response) as any;
    }

    /**
     * Render raw markdown as HTML
     */
    async renderMarkdownRaw(requestParameters: RenderMarkdownRawRequest, initOverrides?: RequestInit): Promise<string> {
        const response = await this.renderMarkdownRawRaw(requestParameters, initOverrides);
        return await response.value();
    }

Related issues/PRs
Suggest a fix

renderMarkdown generate

  1. public method renderMarkdown()
  2. and private internal #renderMarkdown()

renderMarkdownRaw generate

  1. public method renderMarkdownRaw()
  2. and private internal #renderMarkdownRaw()
class X {
    renderMarkdown() { return this.#renderMarkdownRaw() }
    // deprecate: renderMarkdownRaw() { console.log('renderMarkdown') }
    #renderMarkdown() { console.log('renderMarkdown') }

    renderMarkdownRaw() { return this.#renderMarkdownRawRaw() }
    // deprecate: renderMarkdownRawRaw() { console.log('renderMarkdownRaw') }
    #renderMarkdownRaw() { console.log('renderMarkdownRaw') }
}
const x = new X()
x.renderMarkdown()
x.renderMarkdownRaw()

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

Reproduce the generator command with https://try.gitea.io/swagger.v1.json, then inspect the generated src/apis/MiscellaneousApi.ts, src/apis/index.ts, and src/runtime.ts. Compare the duplicate method declarations and TypeScript compiler errors with the requested public/internal method behavior. Done means the generated typescript-fetch client compiles without the reported duplicate or export errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
openapi, typescript
Domain
api, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.