From 202f8269743e05c91fe18162220c1037e0da826d Mon Sep 17 00:00:00 2001 From: adrien-powder Date: Wed, 8 Mar 2023 10:17:36 +0100 Subject: [PATCH 1/9] forking --- .circleci/config.yml | 32 -------------------- .github/ISSUE_TEMPLATE/bug_report.md | 11 ------- .github/ISSUE_TEMPLATE/feature_request.md | 11 ------- .github/dependabot.yml | 22 -------------- .github/workflows/auto-merge.yml | 29 ------------------ .github/workflows/publish-packages.yml | 37 +++++++++++++++++++++++ package-lock.json | 4 +-- package.json | 13 ++++---- tsconfig.json | 1 + 9 files changed, 46 insertions(+), 114 deletions(-) delete mode 100644 .circleci/config.yml delete mode 100644 .github/ISSUE_TEMPLATE/bug_report.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md delete mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/auto-merge.yml create mode 100644 .github/workflows/publish-packages.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index fe53ab1f2..000000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,32 +0,0 @@ -version: 2 -jobs: - build: - docker: - - image: cimg/node:lts-browsers - resource_class: large - working_directory: ~/repo - steps: - - checkout - - restore_cache: - keys: - - v1-dependencies-{{ checksum "package-lock.json" }} - - v1-dependencies- - - run: - name: Install dependencies - command: npm install - - save_cache: - key: v1-dependencies-{{ checksum "package-lock.json" }} - paths: - - node_modules - - run: - name: Build library - command: npm run release - - run: - name: Run unit tests - command: npm run test -# - run: -# name: Run e2e tests -# command: npm run test:e2e - - run: - name: Submit to Codecov - command: npm run codecov diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md deleted file mode 100644 index 456d1d9ed..000000000 --- a/.github/ISSUE_TEMPLATE/bug_report.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Bug report -about: Create a report to help us improve -title: '' -labels: '' -assignees: ferdikoomen - ---- - -**Describe the bug** -A clear and concise description of what the bug is. Ideally with a screenshot of the result or a link to a small example. diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index 902bbe4b2..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,11 +0,0 @@ ---- -name: Feature request -about: Suggest an idea for this project -title: '' -labels: '' -assignees: '' - ---- - -**Describe the solution you'd like** -A clear and concise description of what you want to happen. Ideally with a small example of the proposed changes. diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 77d50f37b..000000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,22 +0,0 @@ -version: 2 -updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: "daily" - ignore: - - dependency-name: "@types/node-fetch" - - dependency-name: "node-fetch" - - dependency-name: "camelcase" - - dependency-name: "@angular-devkit/build-angular" - - dependency-name: "@angular/animations" - - dependency-name: "@angular/cli" - - dependency-name: "@angular/common" - - dependency-name: "@angular/compiler" - - dependency-name: "@angular/compiler-cli" - - dependency-name: "@angular/core" - - dependency-name: "@angular/forms" - - dependency-name: "@angular/platform-browser" - - dependency-name: "@angular/platform-browser-dynamic" - - dependency-name: "@angular/router" - - dependency-name: "typescript" \ No newline at end of file diff --git a/.github/workflows/auto-merge.yml b/.github/workflows/auto-merge.yml deleted file mode 100644 index 5d5d5301d..000000000 --- a/.github/workflows/auto-merge.yml +++ /dev/null @@ -1,29 +0,0 @@ -name: auto-merge - -on: pull_request_target - -permissions: - pull-requests: write - contents: write - -jobs: - dependabot: - runs-on: ubuntu-latest - if: ${{ github.actor == 'dependabot[bot]' }} - steps: - - name: Fetch Dependabot metadata - id: dependabot-metadata - uses: dependabot/fetch-metadata@v1 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - - name: Approve PR - run: gh pr review --approve "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Merge PR - if: ${{ steps.dependabot-metadata.outputs.update-type != 'version-update:semver-major' }} - run: gh pr merge --auto --squash "$PR_URL" - env: - PR_URL: ${{ github.event.pull_request.html_url }} - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/publish-packages.yml b/.github/workflows/publish-packages.yml new file mode 100644 index 000000000..2d5f91fd7 --- /dev/null +++ b/.github/workflows/publish-packages.yml @@ -0,0 +1,37 @@ +name: Publish Packages + +on: + workflow_dispatch: {} + # inputs: + # version: + # description: 'major | minor | patch' + # required: true + # default: 'patch' + +jobs: + publish-packages: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: '18' + + - name: Install Deps + run: | + npm ci + + - name: Creating .npmrc + run: | + cat << EOF > "$HOME/.npmrc" + //registry.npmjs.org/:_authToken=$NPM_TOKEN + EOF + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish Packages + run: | + npm publish --access restricted diff --git a/package-lock.json b/package-lock.json index ee56b63da..884c036a9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "openapi-typescript-codegen", + "name": "@powdergg/openapi-typescript-codegen", "version": "0.23.0", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "openapi-typescript-codegen", + "name": "@powdergg/openapi-typescript-codegen", "version": "0.23.0", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index f801755be..311d68423 100644 --- a/package.json +++ b/package.json @@ -1,15 +1,15 @@ { - "name": "openapi-typescript-codegen", - "version": "0.23.0", + "name": "@powdergg/openapi-typescript-codegen", + "version": "0.1.0", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", - "homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen", + "homepage": "https://github.com/gustvision/openapi-typescript-codegen", "repository": { "type": "git", - "url": "git+https://github.com/ferdikoomen/openapi-typescript-codegen.git" + "url": "git+https://github.com/gustvision/openapi-typescript-codegen.git" }, "bugs": { - "url": "https://github.com/ferdikoomen/openapi-typescript-codegen/issues" + "url": "https://github.com/gustvision/openapi-typescript-codegen/issues" }, "license": "MIT", "keywords": [ @@ -55,8 +55,7 @@ "test:e2e": "jest --selectProjects E2E --runInBand --verbose", "eslint": "eslint .", "eslint:fix": "eslint . --fix", - "prepublishOnly": "npm run clean && npm run release", - "codecov": "codecov --token=66c30c23-8954-4892-bef9-fbaed0a2e42b" + "prepublishOnly": "npm run clean && npm run release" }, "dependencies": { "camelcase": "^6.3.0", diff --git a/tsconfig.json b/tsconfig.json index 8d27e49a8..9727ec856 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,4 +1,5 @@ { + "$schema": "https://json.schemastore.org/tsconfig", "compilerOptions": { "outDir": "./dist", "target": "es2019", From 227a083decf8b1d0cd3c3ef92dfce90e8841e195 Mon Sep 17 00:00:00 2001 From: adrien-powder Date: Wed, 8 Mar 2023 11:31:49 +0100 Subject: [PATCH 2/9] feat: add ApiRequestAdditionalOptions --- build-and-test.cmd | 1 + src/templates/core/ApiRequestAdditionalOptions.hbs | 5 +++++ src/templates/exportService.hbs | 4 ++-- src/templates/partials/parameters.hbs | 2 ++ src/utils/registerHandlebarTemplates.ts | 3 +++ src/utils/writeClient.spec.ts | 1 + src/utils/writeClientClass.spec.ts | 1 + src/utils/writeClientCore.spec.ts | 1 + src/utils/writeClientCore.ts | 1 + src/utils/writeClientIndex.spec.ts | 1 + src/utils/writeClientModels.spec.ts | 1 + src/utils/writeClientSchemas.spec.ts | 1 + src/utils/writeClientServices.spec.ts | 1 + 13 files changed, 21 insertions(+), 2 deletions(-) create mode 100644 build-and-test.cmd create mode 100644 src/templates/core/ApiRequestAdditionalOptions.hbs diff --git a/build-and-test.cmd b/build-and-test.cmd new file mode 100644 index 000000000..bb6d3fa50 --- /dev/null +++ b/build-and-test.cmd @@ -0,0 +1 @@ +npm run build && node ./bin --input ./samples/spec/v3.json --useOptions --client axios --name VerseAxiosClient --output ./.tmp/generated-axios-client diff --git a/src/templates/core/ApiRequestAdditionalOptions.hbs b/src/templates/core/ApiRequestAdditionalOptions.hbs new file mode 100644 index 000000000..d1a7a016c --- /dev/null +++ b/src/templates/core/ApiRequestAdditionalOptions.hbs @@ -0,0 +1,5 @@ +{{>header}} + +export type ApiRequestAdditionalOptions = { + readonly headers?: Record; +}; diff --git a/src/templates/exportService.hbs b/src/templates/exportService.hbs index d6bccbbeb..fe162ff2f 100644 --- a/src/templates/exportService.hbs +++ b/src/templates/exportService.hbs @@ -30,6 +30,7 @@ import type { BaseHttpRequest } from '../core/BaseHttpRequest'; import { OpenAPI } from '../core/OpenAPI'; import { request as __request } from '../core/request'; {{/if}} +import type { ApiRequestAdditionalOptions } from '../core/ApiRequestAdditionalOptions'; {{#equals @root.httpClient 'angular'}} @Injectable({ @@ -103,13 +104,12 @@ export class {{{name}}}{{{@root.postfix}}} { {{/each}} }, {{/if}} - {{#if parametersHeader}} headers: { + ...opts?.headers, {{#each parametersHeader}} '{{{prop}}}': {{{name}}}, {{/each}} }, - {{/if}} {{#if parametersQuery}} query: { {{#each parametersQuery}} diff --git a/src/templates/partials/parameters.hbs b/src/templates/partials/parameters.hbs index 57ab5a7d1..6314ed148 100644 --- a/src/templates/partials/parameters.hbs +++ b/src/templates/partials/parameters.hbs @@ -25,4 +25,6 @@ {{{name}}}{{>isRequired}}: {{>type}}{{#if default}} = {{{default}}}{{/if}}, {{/each}} {{/if}} +, {{/if}} +opts?: ApiRequestAdditionalOptions diff --git a/src/utils/registerHandlebarTemplates.ts b/src/utils/registerHandlebarTemplates.ts index bf77cbdc1..167a18101 100644 --- a/src/utils/registerHandlebarTemplates.ts +++ b/src/utils/registerHandlebarTemplates.ts @@ -11,6 +11,7 @@ import angularSendRequest from '../templates/core/angular/sendRequest.hbs'; import templateCoreApiError from '../templates/core/ApiError.hbs'; import templateCoreApiRequestOptions from '../templates/core/ApiRequestOptions.hbs'; import templateCoreApiResult from '../templates/core/ApiResult.hbs'; +import templateCoreApiRequestAdditionalOptions from '../templates/core/ApiRequestAdditionalOptions.hbs'; import axiosGetHeaders from '../templates/core/axios/getHeaders.hbs'; import axiosGetRequestBody from '../templates/core/axios/getRequestBody.hbs'; import axiosGetResponseBody from '../templates/core/axios/getResponseBody.hbs'; @@ -102,6 +103,7 @@ export interface Templates { request: Handlebars.TemplateDelegate; baseHttpRequest: Handlebars.TemplateDelegate; httpRequest: Handlebars.TemplateDelegate; + apiRequestAdditionalOptions: Handlebars.TemplateDelegate; }; } @@ -129,6 +131,7 @@ export const registerHandlebarTemplates = (root: { settings: Handlebars.template(templateCoreSettings), apiError: Handlebars.template(templateCoreApiError), apiRequestOptions: Handlebars.template(templateCoreApiRequestOptions), + apiRequestAdditionalOptions: Handlebars.template(templateCoreApiRequestAdditionalOptions), apiResult: Handlebars.template(templateCoreApiResult), cancelablePromise: Handlebars.template(templateCancelablePromise), request: Handlebars.template(templateCoreRequest), diff --git a/src/utils/writeClient.spec.ts b/src/utils/writeClient.spec.ts index 3c06a95a5..45ab7b5ce 100644 --- a/src/utils/writeClient.spec.ts +++ b/src/utils/writeClient.spec.ts @@ -28,6 +28,7 @@ describe('writeClient', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', diff --git a/src/utils/writeClientClass.spec.ts b/src/utils/writeClientClass.spec.ts index 102f2eb57..9e43831c3 100644 --- a/src/utils/writeClientClass.spec.ts +++ b/src/utils/writeClientClass.spec.ts @@ -28,6 +28,7 @@ describe('writeClientClass', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', diff --git a/src/utils/writeClientCore.spec.ts b/src/utils/writeClientCore.spec.ts index 36990054e..e73b4acf8 100644 --- a/src/utils/writeClientCore.spec.ts +++ b/src/utils/writeClientCore.spec.ts @@ -30,6 +30,7 @@ describe('writeClientCore', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', diff --git a/src/utils/writeClientCore.ts b/src/utils/writeClientCore.ts index 6d35849d2..748ab54ae 100644 --- a/src/utils/writeClientCore.ts +++ b/src/utils/writeClientCore.ts @@ -40,6 +40,7 @@ export const writeClientCore = async ( await writeFile(resolve(outputPath, 'OpenAPI.ts'), i(templates.core.settings(context), indent)); await writeFile(resolve(outputPath, 'ApiError.ts'), i(templates.core.apiError(context), indent)); await writeFile(resolve(outputPath, 'ApiRequestOptions.ts'), i(templates.core.apiRequestOptions(context), indent)); + await writeFile(resolve(outputPath, 'ApiRequestAdditionalOptions.ts'), i(templates.core.apiRequestAdditionalOptions(context), indent)); await writeFile(resolve(outputPath, 'ApiResult.ts'), i(templates.core.apiResult(context), indent)); await writeFile(resolve(outputPath, 'CancelablePromise.ts'), i(templates.core.cancelablePromise(context), indent)); await writeFile(resolve(outputPath, 'request.ts'), i(templates.core.request(context), indent)); diff --git a/src/utils/writeClientIndex.spec.ts b/src/utils/writeClientIndex.spec.ts index a74421115..bd9420fc6 100644 --- a/src/utils/writeClientIndex.spec.ts +++ b/src/utils/writeClientIndex.spec.ts @@ -26,6 +26,7 @@ describe('writeClientIndex', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', diff --git a/src/utils/writeClientModels.spec.ts b/src/utils/writeClientModels.spec.ts index e147c8e73..c436dee9f 100644 --- a/src/utils/writeClientModels.spec.ts +++ b/src/utils/writeClientModels.spec.ts @@ -43,6 +43,7 @@ describe('writeClientModels', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', diff --git a/src/utils/writeClientSchemas.spec.ts b/src/utils/writeClientSchemas.spec.ts index f71286232..4a362d4a7 100644 --- a/src/utils/writeClientSchemas.spec.ts +++ b/src/utils/writeClientSchemas.spec.ts @@ -43,6 +43,7 @@ describe('writeClientSchemas', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', diff --git a/src/utils/writeClientServices.spec.ts b/src/utils/writeClientServices.spec.ts index b7ebbfe6c..df66cef98 100644 --- a/src/utils/writeClientServices.spec.ts +++ b/src/utils/writeClientServices.spec.ts @@ -31,6 +31,7 @@ describe('writeClientServices', () => { settings: () => 'settings', apiError: () => 'apiError', apiRequestOptions: () => 'apiRequestOptions', + apiRequestAdditionalOptions: () => 'apiRequestAdditionalOptions', apiResult: () => 'apiResult', cancelablePromise: () => 'cancelablePromise', request: () => 'request', From ca6e15dc256fc121f1a4e1b67493457ac91b8431 Mon Sep 17 00:00:00 2001 From: adrien-powder Date: Wed, 8 Mar 2023 11:32:19 +0100 Subject: [PATCH 3/9] 0.2.0 --- package-lock.json | 4 ++-- package.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 884c036a9..98bef5182 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.23.0", + "version": "0.2.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.23.0", + "version": "0.2.0", "license": "MIT", "dependencies": { "camelcase": "^6.3.0", diff --git a/package.json b/package.json index 311d68423..5b2dea824 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.1.0", + "version": "0.2.0", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/gustvision/openapi-typescript-codegen", @@ -119,7 +119,7 @@ "typescript": "4.8.4", "zone.js": "0.11.8" }, - "overrides" : { + "overrides": { "rollup": "3.2.3" } } From 55788684766d85cce026765d770cc9cabf0dc327 Mon Sep 17 00:00:00 2001 From: jeremyPowder Date: Wed, 10 Jan 2024 14:27:26 +0100 Subject: [PATCH 4/9] fix: getFormData --- src/templates/core/functions/getFormData.hbs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/templates/core/functions/getFormData.hbs b/src/templates/core/functions/getFormData.hbs index 3a74b8f3a..b0b4f3abb 100644 --- a/src/templates/core/functions/getFormData.hbs +++ b/src/templates/core/functions/getFormData.hbs @@ -1,4 +1,7 @@ const getFormData = (options: ApiRequestOptions): FormData | undefined => { + if (options.formData instanceof FormData) { + return options.formData + } if (options.formData) { const formData = new FormData(); From de14b9ed92edf1d6872d5de0f650aa95d75fec1d Mon Sep 17 00:00:00 2001 From: jeremyPowder Date: Wed, 10 Jan 2024 14:28:59 +0100 Subject: [PATCH 5/9] 0.3.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 98bef5182..0cfb2e7e9 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.2.0", + "version": "0.3.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.2.0", + "version": "0.3.0", "license": "MIT", "dependencies": { "camelcase": "^6.3.0", diff --git a/package.json b/package.json index 5b2dea824..04ffa66ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.2.0", + "version": "0.3.0", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/gustvision/openapi-typescript-codegen", From 98ef86b4e49c39ac94e55994ec0b951af883b408 Mon Sep 17 00:00:00 2001 From: jeremyPowder Date: Mon, 28 Oct 2024 15:56:14 +0100 Subject: [PATCH 6/9] give possibility to overide axios --- src/templates/core/axios/request.hbs | 7 ++++--- src/templates/core/axios/sendRequest.hbs | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/templates/core/axios/request.hbs b/src/templates/core/axios/request.hbs index 19ebd5fb9..6612f1614 100644 --- a/src/templates/core/axios/request.hbs +++ b/src/templates/core/axios/request.hbs @@ -1,7 +1,7 @@ {{>header}} import axios from 'axios'; -import type { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios'; +import type { AxiosError, AxiosRequestConfig, AxiosResponse, AxiosInstance } from 'axios'; import FormData from 'form-data'; import { ApiError } from './ApiError'; @@ -66,10 +66,11 @@ import type { OpenAPIConfig } from './OpenAPI'; * Request method * @param config The OpenAPI configuration object * @param options The request options from the service + * @param axiosClient The axios client instance to use * @returns CancelablePromise * @throws ApiError */ -export const request = (config: OpenAPIConfig, options: ApiRequestOptions): CancelablePromise => { +export const request = (config: OpenAPIConfig, options: ApiRequestOptions, axiosClient: AxiosInstance = axios): CancelablePromise => { return new CancelablePromise(async (resolve, reject, onCancel) => { try { const url = getUrl(config, options); @@ -78,7 +79,7 @@ export const request = (config: OpenAPIConfig, options: ApiRequestOptions): C const headers = await getHeaders(config, options, formData); if (!onCancel.isCancelled) { - const response = await sendRequest(config, options, url, body, formData, headers, onCancel); + const response = await sendRequest(config, options, url, body, formData, headers, onCancel, axiosClient); const responseBody = getResponseBody(response); const responseHeader = getResponseHeader(response, options.responseHeader); diff --git a/src/templates/core/axios/sendRequest.hbs b/src/templates/core/axios/sendRequest.hbs index 0b871ea36..11f3f6643 100644 --- a/src/templates/core/axios/sendRequest.hbs +++ b/src/templates/core/axios/sendRequest.hbs @@ -6,6 +6,7 @@ const sendRequest = async ( formData: FormData | undefined, headers: Record, onCancel: OnCancel + axiosClient: AxiosInstance ): Promise> => { const source = axios.CancelToken.source(); @@ -21,7 +22,7 @@ const sendRequest = async ( onCancel(() => source.cancel('The user aborted a request.')); try { - return await axios.request(requestConfig); + return await axiosClient.request(requestConfig); } catch (error) { const axiosError = error as AxiosError; if (axiosError.response) { From 87aaec00347d524c2c0b4898ce7cf2eac8b1d458 Mon Sep 17 00:00:00 2001 From: jeremyPowder Date: Mon, 28 Oct 2024 15:57:52 +0100 Subject: [PATCH 7/9] 0.4.0 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 0cfb2e7e9..54deab1c5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.3.0", + "version": "0.4.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.3.0", + "version": "0.4.0", "license": "MIT", "dependencies": { "camelcase": "^6.3.0", diff --git a/package.json b/package.json index 04ffa66ec..be058578e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.3.0", + "version": "0.4.0", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/gustvision/openapi-typescript-codegen", From cf08f8bf2d6d163fd6e5e8fc747d030f95246aea Mon Sep 17 00:00:00 2001 From: jeremyPowder Date: Mon, 28 Oct 2024 16:32:08 +0100 Subject: [PATCH 8/9] fix --- src/templates/core/axios/sendRequest.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/templates/core/axios/sendRequest.hbs b/src/templates/core/axios/sendRequest.hbs index 11f3f6643..4d3c0f402 100644 --- a/src/templates/core/axios/sendRequest.hbs +++ b/src/templates/core/axios/sendRequest.hbs @@ -5,7 +5,7 @@ const sendRequest = async ( body: any, formData: FormData | undefined, headers: Record, - onCancel: OnCancel + onCancel: OnCancel, axiosClient: AxiosInstance ): Promise> => { const source = axios.CancelToken.source(); From b49c199598dbc959e889494ace7715c69b278780 Mon Sep 17 00:00:00 2001 From: jeremyPowder Date: Mon, 28 Oct 2024 16:32:31 +0100 Subject: [PATCH 9/9] 0.4.1 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 54deab1c5..e04e4cc3b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.4.0", + "version": "0.4.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.4.0", + "version": "0.4.1", "license": "MIT", "dependencies": { "camelcase": "^6.3.0", diff --git a/package.json b/package.json index be058578e..37b2a5f07 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@powdergg/openapi-typescript-codegen", - "version": "0.4.0", + "version": "0.4.1", "description": "Library that generates Typescript clients based on the OpenAPI specification.", "author": "Ferdi Koomen", "homepage": "https://github.com/gustvision/openapi-typescript-codegen",