diff --git a/FETCH_MIGRATION.md b/FETCH_MIGRATION.md index 8e9ced3a8e3..85e7100f477 100644 --- a/FETCH_MIGRATION.md +++ b/FETCH_MIGRATION.md @@ -8,6 +8,13 @@ Fetch was selected as the new HTTP request library for this project due to its w For more details see the initial discussion ([#754](https://github.com/kubernetes-client/javascript/issues/754)). +Edit 02/2022: + +Since the OpenApiGenerator project is targeting a single `typescript` generator (instead of individual networking flavors eg: typescript-fetch, typescript-axios) that includes node-fetch support, the initial plans to import and inject node-fetch is no longer optimal. + +The proposed changes have been implemented on the new `typescript` generator which includes changes to the authentication and authorization interface that now uses a `RequestContext` object instead of directly allowing access to the https request options. In order to bridge the existing javascript client auth methods, additional exposure via custom SecurityAuthentication support has [been merged](https://github.com/OpenAPITools/openapi-generator/pull/11321) into the typescript generator. + + ## Release cycle The fetch generator will create breaking changes to this project's API. Consumers will have to make small modifications to their code to upgrade. @@ -40,31 +47,23 @@ Code will be on the `master` branch. ### Other repositories - [x] Update [kubernetes-client/gen](https://github.com/kubernetes-client/gen)'s typescript-fetch files to let us pass in the `typescriptThreePlus` config option [1](https://github.com/OpenAPITools/openapi-generator/issues/9973) [2](https://github.com/OpenAPITools/openapi-generator/issues/3869#issuecomment-584152932) -- [ ] Update [openapi-generator](https://github.com/OpenAPITools/openapi-generator)'s typescript-fetch flavor to mark parameters as optional if all parameters are optional [3](https://github.com/OpenAPITools/openapi-generator/issues/6440) +- [x] Update [openapi-generator](https://github.com/OpenAPITools/openapi-generator)'s typescript-fetch flavor to mark parameters as optional if all parameters are optional [3](https://github.com/OpenAPITools/openapi-generator/issues/6440) ### Kubernetes-client repository -- [ ] Increment `OPENAPI_GENERATOR_COMMIT` to be [version 5.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.3.0) (with the optional parameters addition) -- [ ] `npm install node-fetch` to install node-fetch -- [ ] Switch generate-client script to use typescript-fetch -- [ ] Import and inject node-fetch in `src/api.ts` with the following - -```typescript -import fetch from 'node-fetch'; - -// inject node-fetch -if (!globalThis.fetch) { - // @ts-ignore - globalThis.fetch = fetch; - globalThis.Headers = Headers; - globalThis.Request = Request; - globalThis.Response = Response; -} -``` - -- [ ] Generate api with `npm run generate` -- [ ] Match src/gen/api.ts to new generated layout (it changes slightly) -- [ ] Fix errors in /src folder (due to new api) +- [x] Increment `OPENAPI_GENERATOR_COMMIT` to be [version 5.3.0](https://github.com/OpenAPITools/openapi-generator/releases/tag/v5.3.0) (with the optional parameters addition) +- [x] `npm install node-fetch` to install node-fetch +- [ ] ~~Switch generate-client script to use typescript-fetch~~ (see edit 02/2022) +- [ ] ~~Import and inject node-fetch in `src/api.ts`~~ (see edit 02/2022) + +- [x] Generate api with `npm run generate` +- [x] Match src/gen/api.ts to new generated layout (it changes slightly) + +- [ ] Fix errors in /src folder (due to new generated api) + - [ ] Migrate watch.ts to use node-fetch + - [ ] Migrate log.ts to use node-fetch + - [ ] Migrate metrics.ts to use node-fetch + - [ ] Migrate HttpError Usage to HttpException (following new OpenApiGen convention) - [ ] Fix errors in test (due to new api) - [ ] Test all features - [ ] Fix examples (due to new api)