Skip to content
New issue

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

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

Already on GitHub? # to your account

[BUG] Typescript-fetch : The options parameter is gone. No way to pass options. #3402

Closed
5 of 6 tasks
JFCote opened this issue Jul 19, 2019 · 3 comments · Fixed by #3586
Closed
5 of 6 tasks

[BUG] Typescript-fetch : The options parameter is gone. No way to pass options. #3402

JFCote opened this issue Jul 19, 2019 · 3 comments · Fixed by #3586

Comments

@JFCote
Copy link
Member

JFCote commented Jul 19, 2019

Bug Report Checklist

  • Have you provided a full/minimal spec to reproduce the issue?
  • Have you validated the input using an OpenAPI validator (example)?
  • What's the version of OpenAPI Generator used?
  • Have you search for related issues/PRs?
  • What's the actual output vs expected output?
  • [Optional] Bounty to sponsor the fix (example)
Description

The new version of the typescript-fetch generator seems to have completely dropped the second parameters for each call that provided a way to pass options. For example, specific header or configuration.

As you can see in version 3.3.4 tag, there is always a second parameter to each calls.
https://github.com/OpenAPITools/openapi-generator/blob/v3.3.4/modules/openapi-generator/src/main/resources/typescript-fetch/api.mustache#L93

In the current master, there is no such call and I don't see any way to pass this information.

For example, in our application, we were always passing this:

{
    credentials: "include",
    headers: {
        'Cache-Control': 'no-cache, no-store'
    }
}

Is there another way to achieve the same thing using the new generator or should I create a new PR to add back this functionality?

openapi-generator version

4.X.X (master)

OpenAPI declaration file content or url

Any spec

Command line used for generation

Any typescript-fetch generation

Steps to reproduce

Generate a typescript-fetch client and notice the issue

Related issues/PRs

Didn't find anything related to this

Suggest a fix

Add the functionality back (have a second parameter everywhere)

@macjohnny
Copy link
Member

I think adding back this functionality in the existing generator is fine.

@JFCote
Copy link
Member Author

JFCote commented Aug 5, 2019

I'm back from vacation and will look to implement this somewhere this week.

JFCote added a commit that referenced this issue Aug 8, 2019
… credentials parameters to the fetch query.
@JFCote
Copy link
Member Author

JFCote commented Aug 8, 2019

Shoud be fix with this PR: #3586

JFCote added a commit that referenced this issue Aug 8, 2019
macjohnny pushed a commit that referenced this issue Aug 8, 2019
* Fix #3402 by giving the possibility to set additional headers and the credentials parameters to the fetch query.

* Fix #3402 : Changes from code review
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants