Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] [typescript-fetch] initOverrides added in 5.2.1 breaking change #10258

Closed
mikkovor opened this issue Aug 25, 2021 · 4 comments
Closed

[BUG] [typescript-fetch] initOverrides added in 5.2.1 breaking change #10258

mikkovor opened this issue Aug 25, 2021 · 4 comments

Comments

@mikkovor
Copy link

mikkovor commented Aug 25, 2021

Description

The new initOverrides? optional parameter added in 5.2.1 is not working for us at least

openapi-generator version

5.2.1

Script that we use is simply:

npx @openapitools/openapi-generator-cli generate -i swagger.json -g typescript-fetch -o .\src\api

All of the generated Raw methods have this:

const response = await this.request({
            ...
        }, initOverrides);

but the actual request looks like this:

 protected async request(context: RequestOpts): Promise<Response> {
    const { url, init } = this.createFetchParams(context);
    const response = await this.fetchApi(url, init);
    if (response.status >= 200 && response.status < 300) {
      return response;
    }
    throw response;
  }

and the interface like this:

export interface RequestOpts {
  path: string;
  method: HTTPMethod;
  headers: HTTPHeaders;
  query?: HTTPQuery;
  body?: HTTPBody;
}

So I don't know where initOverrides should fit in there exactly?

Related issues/PRs

I guess this is where it was added?

#10050

@wing328
Copy link
Member

wing328 commented Aug 26, 2021

@mikkovor thanks for reporting the issue.

Can you please reply directly to the PR with the details?

@mikkovor
Copy link
Author

mikkovor commented Aug 26, 2021

I added more information there. Looks like in the 5.2.1 tag the request should include the new initOverrides parameter but for some reason it generates the old one

@badsyntax
Copy link
Contributor

I'm happy to take a look at this. I'm responding in the original PR.

@mikkovor
Copy link
Author

mikkovor commented Aug 26, 2021

Yeah, looks like the script file had an innocent looking line at the end git checkout src/api/runtime.ts which was the cause of this headache 🤦‍♂️ closing the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants