Created by: petermetz
Signed-off-by: Peter Somogyvari peter.metz@unarin.com
Added an optional parameter to the constructor parameters of the Configuration
class so that a user defind FormData
constructor can be injected in execution environments where FormData
is not supported by default (e.g. NodeJS).
This issue is tracking the same problem which I also had and thus this PR was born: https://github.com/OpenAPITools/openapi-generator/issues/2939
I tested it by using the generator on a project I'm a maintainer of where we use the tool (thank you very much for the all your work)
What this enables is code like this in my NodeJS test cases:
import FormData from "form-data";
const configuration: Configuration = new Configuration({
formDataCtor: FormData,
...
});
const apiClient = new DefaultApi(configuration);
// now apiClient can work with multipart form data endpoints from
// NodeJS not just the browser (assuming the npm `form-data`
// module works as advertised of course).
PR checklist
-
Read the contribution guidelines. -
Pull Request title clearly describes the work in the pull request and Pull Request description provides details about how to validate the work. Missing information here may result in delayed response from the community. -
If contributing template-only or documentation-only changes which will change sample output, build the project beforehand. -
Run the shell script ./bin/generate-samples.sh
to update all Petstore samples related to your fix. This is important, as CI jobs will verify all generator outputs of your HEAD commit as it would merge with master. These must match the expectations made by your contribution. You may regenerate an individual generator by passing the relevant config(s) as an argument to the script, for example./bin/generate-samples.sh bin/configs/java*
. For Windows users, please run the script in Git BASH. -
File the PR against the correct branch: master
-
Copy the technical committee to review the pull request if your PR is targeting a particular programming language.
cc technical committee for Typescript and NodeJS:
@TiFu (2017/07) @taxpon (2017/07) @sebastianhaas (2017/07) @kenisteward (2017/07) @Vrolijkx (2017/09) @macjohnny (2018/01) @topce (2018/10) @akehir (2019/07) @petejohansonxo (2019/11) @amakhrov (2020/02)
@CodeNinjai (2017/07) @frol (2017/07) @cliffano (2017/07)