From a5951db2f7f1c8759d0e00983faafab251e286c5 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Thu, 20 Nov 2025 23:58:12 -0500 Subject: [PATCH 01/10] migrate typescript generator to undici --- .../resources/typescript/http/http.mustache | 16 ++- .../typescript/http/isomorphic-fetch.mustache | 4 +- .../resources/typescript/package.mustache | 5 +- .../typescript/builds/default/http/http.ts | 31 +++-- .../builds/default/http/isomorphic-fetch.ts | 48 ++++---- .../builds/default/package-lock.json | 108 ++++++------------ .../typescript/builds/default/package.json | 6 +- 7 files changed, 88 insertions(+), 130 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache index 67ff4139aee1..46dd740b7d4d 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/http.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/http.mustache @@ -3,8 +3,7 @@ // TODO: evaluate if we can easily get rid of this library import {{^supportsES6}}* as{{/supportsES6}} FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; {{/node}} {{/platforms}} import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{importFileExtension}}'{{/useRxJS}}; @@ -106,7 +105,7 @@ export class RequestContext { private signal: AbortSignal | undefined = undefined; {{#platforms}} {{#node}} - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; {{/node}} {{/platforms}} @@ -182,7 +181,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -196,13 +195,12 @@ export class RequestContext { {{#platforms}} {{#node}} - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } {{/node}} {{/platforms}} diff --git a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache index b822d4d9d3ad..a4f779b937c4 100644 --- a/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/http/isomorphic-fetch.mustache @@ -2,7 +2,7 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http{{importFileEx import { from, Observable } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{importFileExtension}}'{{/useRxJS}}; {{#platforms}} {{#node}} -import fetch from "node-fetch"; +import { fetch } from 'undici'; {{/node}} {{#browser}} import "whatwg-fetch"; @@ -22,7 +22,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { signal: request.getSignal(), {{#platforms}} {{#node}} - agent: request.getAgent(), + dispatcher: request.getDispatcher(), {{/node}} {{#browser}} credentials: "same-origin" diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index bec909615ae3..1c67787cd504 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -46,8 +46,7 @@ {{#fetch-api}} {{#platforms}} {{#node}} - "node-fetch": "^2.7.0", - "@types/node-fetch": "^2.6.13", + "undici": "^7.16.0" {{/node}} {{#browser}} "whatwg-fetch": "^3.0.0", @@ -61,7 +60,7 @@ {{/frameworks}} {{#platforms}} {{#node}} - "@types/node": "^16.18.126", + "@types/node": "^20.17.10", "form-data": "^4.0.4", {{/node}} {{/platforms}} diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 7eaf00563272..1ee8b6dcf89b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -1,9 +1,8 @@ // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; import { Observable, from } from '../rxjsStub'; +import { type Dispatcher } from 'undici'; export * from './isomorphic-fetch'; @@ -58,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined; /** * Creates the request context using a http method and request resource url @@ -132,7 +131,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -145,12 +144,12 @@ export class RequestContext { } - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } @@ -163,7 +162,7 @@ export interface ResponseBody { * Helper class to generate a `ResponseBody` from binary data */ export class SelfDecodingBody implements ResponseBody { - constructor(private dataSource: Promise) {} + constructor(private dataSource: Promise) { } binary(): Promise { return this.dataSource; @@ -180,7 +179,7 @@ export class ResponseContext { public httpStatusCode: number, public headers: Headers, public body: ResponseBody - ) {} + ) { } /** * Parse header value in the form `value; param1="value1"` @@ -228,11 +227,11 @@ export class ResponseContext { public getBodyAsAny(): Promise { try { return this.body.text(); - } catch {} + } catch { } try { return this.body.binary(); - } catch {} + } catch { } return Promise.resolve(undefined); } @@ -247,11 +246,11 @@ export interface PromiseHttpLibrary { } export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { - return { - send(request: RequestContext): Observable { - return from(promiseHttpLibrary.send(request)); + return { + send(request: RequestContext): Observable { + return from(promiseHttpLibrary.send(request)); + } } - } } export class HttpInfo extends ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts index d7ce46e4bee8..4d3752714b32 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts @@ -1,33 +1,33 @@ -import {HttpLibrary, RequestContext, ResponseContext} from './http'; +import { HttpLibrary, RequestContext, ResponseContext } from './http'; import { from, Observable } from '../rxjsStub'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { - public send(request: RequestContext): Observable { - let method = request.getHttpMethod().toString(); - let body = request.getBody(); + public send(request: RequestContext): Observable { + let method = request.getHttpMethod().toString(); + let body = request.getBody(); - const resultPromise = fetch(request.getUrl(), { - method: method, - body: body as any, - headers: request.getHeaders(), - signal: request.getSignal(), - agent: request.getAgent(), - }).then((resp: any) => { - const headers: { [name: string]: string } = {}; - resp.headers.forEach((value: string, name: string) => { - headers[name] = value; - }); + const resultPromise = fetch(request.getUrl(), { + method: method, + body: body as any, + headers: request.getHeaders(), + signal: request.getSignal(), + dispatcher: request.getDispatcher() + }).then((resp: any) => { + const headers: { [name: string]: string } = {}; + resp.headers.forEach((value: string, name: string) => { + headers[name] = value; + }); - const body = { - text: () => resp.text(), - binary: () => resp.buffer() - }; - return new ResponseContext(resp.status, headers, body); - }); + const body = { + text: () => resp.text(), + binary: () => resp.buffer() + }; + return new ResponseContext(resp.status, headers, body); + }); - return from>(resultPromise); + return from>(resultPromise); - } + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json index d0b78f9babb6..81a74828f47b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json @@ -9,21 +9,24 @@ "version": "1.0.0", "license": "Unlicense", "dependencies": { - "@types/node": "^16.18.126", + "@types/node": "^20.17.10", "@types/node-fetch": "^2.6.13", "es6-promise": "^4.2.4", "form-data": "^4.0.4", - "node-fetch": "^2.7.0" + "undici": "^7.16.0" }, "devDependencies": { "typescript": "^4.0" } }, "node_modules/@types/node": { - "version": "16.18.126", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", - "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==", - "license": "MIT" + "version": "20.19.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.25.tgz", + "integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } }, "node_modules/@types/node-fetch": { "version": "2.6.13", @@ -277,32 +280,6 @@ "node": ">= 0.6" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "license": "MIT", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==", - "license": "MIT" - }, "node_modules/typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", @@ -316,28 +293,30 @@ "node": ">=4.2.0" } }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==", - "license": "BSD-2-Clause" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", + "node_modules/undici": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz", + "integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==", "license": "MIT", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "engines": { + "node": ">=20.18.1" } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" } }, "dependencies": { "@types/node": { - "version": "16.18.126", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.126.tgz", - "integrity": "sha512-OTcgaiwfGFBKacvfwuHzzn1KLxH/er8mluiy8/uM3sGXHaRe73RrSIj01jow9t4kJEW633Ov+cOexXeiApTyAw==" + "version": "20.19.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.25.tgz", + "integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==", + "requires": { + "undici-types": "~6.21.0" + } }, "@types/node-fetch": { "version": "2.6.13", @@ -506,38 +485,21 @@ "mime-db": "1.40.0" } }, - "node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "requires": { - "whatwg-url": "^5.0.0" - } - }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "typescript": { "version": "4.7.4", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.7.4.tgz", "integrity": "sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ==", "dev": true }, - "webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" + "undici": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz", + "integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==" }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } + "undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==" } } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index be458020cd18..6fa4f2546918 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -31,11 +31,11 @@ "prepare": "npm run build" }, "dependencies": { - "node-fetch": "^2.7.0", + "@types/node": "^20.17.10", "@types/node-fetch": "^2.6.13", - "@types/node": "^16.18.126", + "es6-promise": "^4.2.4", "form-data": "^4.0.4", - "es6-promise": "^4.2.4" + "undici": "^7.16.0" }, "devDependencies": { "typescript": "^4.0" From 6f1a80b424a7040d3ade0dacbad69f7a97513c41 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Thu, 20 Nov 2025 23:59:41 -0500 Subject: [PATCH 02/10] smaples --- .../echo_api/typescript/build/http/http.ts | 16 +++---- .../typescript/build/http/isomorphic-fetch.ts | 4 +- .../echo_api/typescript/build/package.json | 5 +- .../builds/array-of-lists/http/http.ts | 2 +- .../builds/enum-single-value/http/http.ts | 2 +- .../builds/null-types-simple/http/http.ts | 2 +- .../builds/with-unique-items/http/http.ts | 2 +- .../encode-decode/build/http/http.ts | 16 +++---- .../build/http/isomorphic-fetch.ts | 4 +- .../encode-decode/build/package.json | 5 +- .../typescript/builds/browser/http/http.ts | 2 +- .../builds/composed-schemas/http/http.ts | 2 +- .../typescript/builds/default/http/http.ts | 21 ++++----- .../builds/default/http/isomorphic-fetch.ts | 46 +++++++++---------- .../typescript/builds/default/package.json | 5 +- .../typescript/builds/deno/http/http.ts | 2 +- .../builds/deno_object_params/http/http.ts | 2 +- .../builds/explode-query/http/http.ts | 16 +++---- .../explode-query/http/isomorphic-fetch.ts | 4 +- .../builds/explode-query/package.json | 5 +- .../typescript/builds/inversify/http/http.ts | 16 +++---- .../builds/inversify/http/isomorphic-fetch.ts | 4 +- .../typescript/builds/inversify/package.json | 5 +- .../typescript/builds/jquery/http/http.ts | 2 +- .../builds/nullable-enum/http/http.ts | 2 +- .../builds/object_params/http/http.ts | 16 +++---- .../object_params/http/isomorphic-fetch.ts | 4 +- .../builds/object_params/package.json | 5 +- 28 files changed, 100 insertions(+), 117 deletions(-) diff --git a/samples/client/echo_api/typescript/build/http/http.ts b/samples/client/echo_api/typescript/build/http/http.ts index 7eaf00563272..fcedacfb8ed8 100644 --- a/samples/client/echo_api/typescript/build/http/http.ts +++ b/samples/client/echo_api/typescript/build/http/http.ts @@ -1,8 +1,7 @@ // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; import { Observable, from } from '../rxjsStub'; export * from './isomorphic-fetch'; @@ -58,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -132,7 +131,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -144,13 +143,12 @@ export class RequestContext { return this.signal; } - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } diff --git a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts index d7ce46e4bee8..23cfa867b046 100644 --- a/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts +++ b/samples/client/echo_api/typescript/build/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -13,7 +13,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { body: body as any, headers: request.getHeaders(), signal: request.getSignal(), - agent: request.getAgent(), + dispatcher: request.getDispatcher(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index a4d85fed64f7..623cf71910fd 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -31,9 +31,8 @@ "prepare": "npm run build" }, "dependencies": { - "node-fetch": "^2.7.0", - "@types/node-fetch": "^2.6.13", - "@types/node": "^16.18.126", + "undici": "^7.16.0" + "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" }, diff --git a/samples/client/others/typescript/builds/array-of-lists/http/http.ts b/samples/client/others/typescript/builds/array-of-lists/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/client/others/typescript/builds/array-of-lists/http/http.ts +++ b/samples/client/others/typescript/builds/array-of-lists/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/enum-single-value/http/http.ts b/samples/client/others/typescript/builds/enum-single-value/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/client/others/typescript/builds/enum-single-value/http/http.ts +++ b/samples/client/others/typescript/builds/enum-single-value/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/null-types-simple/http/http.ts b/samples/client/others/typescript/builds/null-types-simple/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/client/others/typescript/builds/null-types-simple/http/http.ts +++ b/samples/client/others/typescript/builds/null-types-simple/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/client/others/typescript/builds/with-unique-items/http/http.ts b/samples/client/others/typescript/builds/with-unique-items/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/client/others/typescript/builds/with-unique-items/http/http.ts +++ b/samples/client/others/typescript/builds/with-unique-items/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/client/others/typescript/encode-decode/build/http/http.ts b/samples/client/others/typescript/encode-decode/build/http/http.ts index 7eaf00563272..fcedacfb8ed8 100644 --- a/samples/client/others/typescript/encode-decode/build/http/http.ts +++ b/samples/client/others/typescript/encode-decode/build/http/http.ts @@ -1,8 +1,7 @@ // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; import { Observable, from } from '../rxjsStub'; export * from './isomorphic-fetch'; @@ -58,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -132,7 +131,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -144,13 +143,12 @@ export class RequestContext { return this.signal; } - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } diff --git a/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts b/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts index d7ce46e4bee8..23cfa867b046 100644 --- a/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts +++ b/samples/client/others/typescript/encode-decode/build/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -13,7 +13,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { body: body as any, headers: request.getHeaders(), signal: request.getSignal(), - agent: request.getAgent(), + dispatcher: request.getDispatcher(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { diff --git a/samples/client/others/typescript/encode-decode/build/package.json b/samples/client/others/typescript/encode-decode/build/package.json index 41f90227658c..6f5ab8114a6b 100644 --- a/samples/client/others/typescript/encode-decode/build/package.json +++ b/samples/client/others/typescript/encode-decode/build/package.json @@ -31,9 +31,8 @@ "prepare": "npm run build" }, "dependencies": { - "node-fetch": "^2.7.0", - "@types/node-fetch": "^2.6.13", - "@types/node": "^16.18.126", + "undici": "^7.16.0" + "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" }, diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/browser/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts index 1ee8b6dcf89b..fcedacfb8ed8 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/http.ts @@ -1,8 +1,8 @@ // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import { Observable, from } from '../rxjsStub'; import { type Dispatcher } from 'undici'; +import { Observable, from } from '../rxjsStub'; export * from './isomorphic-fetch'; @@ -57,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private dispatcher: Dispatcher | undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -143,7 +143,6 @@ export class RequestContext { return this.signal; } - public setDispatcher(dispatcher: Dispatcher): void { this.dispatcher = dispatcher; } @@ -162,7 +161,7 @@ export interface ResponseBody { * Helper class to generate a `ResponseBody` from binary data */ export class SelfDecodingBody implements ResponseBody { - constructor(private dataSource: Promise) { } + constructor(private dataSource: Promise) {} binary(): Promise { return this.dataSource; @@ -179,7 +178,7 @@ export class ResponseContext { public httpStatusCode: number, public headers: Headers, public body: ResponseBody - ) { } + ) {} /** * Parse header value in the form `value; param1="value1"` @@ -227,11 +226,11 @@ export class ResponseContext { public getBodyAsAny(): Promise { try { return this.body.text(); - } catch { } + } catch {} try { return this.body.binary(); - } catch { } + } catch {} return Promise.resolve(undefined); } @@ -246,11 +245,11 @@ export interface PromiseHttpLibrary { } export function wrapHttpLibrary(promiseHttpLibrary: PromiseHttpLibrary): HttpLibrary { - return { - send(request: RequestContext): Observable { - return from(promiseHttpLibrary.send(request)); - } + return { + send(request: RequestContext): Observable { + return from(promiseHttpLibrary.send(request)); } + } } export class HttpInfo extends ResponseContext { diff --git a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts index 4d3752714b32..23cfa867b046 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/default/http/isomorphic-fetch.ts @@ -1,33 +1,33 @@ -import { HttpLibrary, RequestContext, ResponseContext } from './http'; +import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { - public send(request: RequestContext): Observable { - let method = request.getHttpMethod().toString(); - let body = request.getBody(); + public send(request: RequestContext): Observable { + let method = request.getHttpMethod().toString(); + let body = request.getBody(); - const resultPromise = fetch(request.getUrl(), { - method: method, - body: body as any, - headers: request.getHeaders(), - signal: request.getSignal(), - dispatcher: request.getDispatcher() - }).then((resp: any) => { - const headers: { [name: string]: string } = {}; - resp.headers.forEach((value: string, name: string) => { - headers[name] = value; - }); + const resultPromise = fetch(request.getUrl(), { + method: method, + body: body as any, + headers: request.getHeaders(), + signal: request.getSignal(), + dispatcher: request.getDispatcher(), + }).then((resp: any) => { + const headers: { [name: string]: string } = {}; + resp.headers.forEach((value: string, name: string) => { + headers[name] = value; + }); - const body = { - text: () => resp.text(), - binary: () => resp.buffer() - }; - return new ResponseContext(resp.status, headers, body); - }); + const body = { + text: () => resp.text(), + binary: () => resp.buffer() + }; + return new ResponseContext(resp.status, headers, body); + }); - return from>(resultPromise); + return from>(resultPromise); - } + } } diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index 6fa4f2546918..6507fe458f38 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -31,11 +31,10 @@ "prepare": "npm run build" }, "dependencies": { + "undici": "^7.16.0" "@types/node": "^20.17.10", - "@types/node-fetch": "^2.6.13", - "es6-promise": "^4.2.4", "form-data": "^4.0.4", - "undici": "^7.16.0" + "es6-promise": "^4.2.4" }, "devDependencies": { "typescript": "^4.0" diff --git a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts index 0b57a8a07b1b..73cd7a4d05b4 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno/http/http.ts @@ -122,7 +122,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts index 0b57a8a07b1b..73cd7a4d05b4 100644 --- a/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/deno_object_params/http/http.ts @@ -122,7 +122,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts index 7eaf00563272..fcedacfb8ed8 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/http.ts @@ -1,8 +1,7 @@ // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; import { Observable, from } from '../rxjsStub'; export * from './isomorphic-fetch'; @@ -58,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -132,7 +131,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -144,13 +143,12 @@ export class RequestContext { return this.signal; } - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts index d7ce46e4bee8..23cfa867b046 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -13,7 +13,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { body: body as any, headers: request.getHeaders(), signal: request.getSignal(), - agent: request.getAgent(), + dispatcher: request.getDispatcher(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json index be458020cd18..6507fe458f38 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json @@ -31,9 +31,8 @@ "prepare": "npm run build" }, "dependencies": { - "node-fetch": "^2.7.0", - "@types/node-fetch": "^2.6.13", - "@types/node": "^16.18.126", + "undici": "^7.16.0" + "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" }, diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts index e96c984cb800..adcf7ece6301 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/http.ts @@ -1,8 +1,7 @@ // TODO: evaluate if we can easily get rid of this library import FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; import { Observable, from } from '../rxjsStub'; export * from './isomorphic-fetch'; @@ -58,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -132,7 +131,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -144,13 +143,12 @@ export class RequestContext { return this.signal; } - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts index d7ce46e4bee8..23cfa867b046 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -13,7 +13,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { body: body as any, headers: request.getHeaders(), signal: request.getSignal(), - agent: request.getAgent(), + dispatcher: request.getDispatcher(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 7ca265741b8c..4185c7b8b23b 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -32,9 +32,8 @@ "prepare": "npm run build" }, "dependencies": { - "node-fetch": "^2.7.0", - "@types/node-fetch": "^2.6.13", - "@types/node": "^16.18.126", + "undici": "^7.16.0" + "@types/node": "^20.17.10", "form-data": "^4.0.4", "inversify": "^6.0.1", "es6-promise": "^4.2.4" diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts index 0fb26e3bb3f8..631d2b1c9dac 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts index d48cbd6b7705..eea0ee0f4ae3 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/http/http.ts @@ -123,7 +123,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts index 7eaf00563272..fcedacfb8ed8 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/http.ts @@ -1,8 +1,7 @@ // TODO: evaluate if we can easily get rid of this library import * as FormData from "form-data"; import { URL, URLSearchParams } from 'url'; -import * as http from 'http'; -import * as https from 'https'; +import { type Dispatcher } from 'undici'; import { Observable, from } from '../rxjsStub'; export * from './isomorphic-fetch'; @@ -58,7 +57,7 @@ export class RequestContext { private body: RequestBody = undefined; private url: URL; private signal: AbortSignal | undefined = undefined; - private agent: http.Agent | https.Agent | undefined = undefined; + private dispatcher: Dispatcher | undefined = undefined; /** * Creates the request context using a http method and request resource url @@ -132,7 +131,7 @@ export class RequestContext { this.headers["Cookie"] += name + "=" + value + "; "; } - public setHeaderParam(key: string, value: string): void { + public setHeaderParam(key: string, value: string): void { this.headers[key] = value; } @@ -144,13 +143,12 @@ export class RequestContext { return this.signal; } - - public setAgent(agent: http.Agent | https.Agent) { - this.agent = agent; + public setDispatcher(dispatcher: Dispatcher): void { + this.dispatcher = dispatcher; } - public getAgent(): http.Agent | https.Agent | undefined { - return this.agent; + public getDispatcher(): Dispatcher | undefined { + return this.dispatcher; } } diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts b/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts index d7ce46e4bee8..23cfa867b046 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/http/isomorphic-fetch.ts @@ -1,6 +1,6 @@ import {HttpLibrary, RequestContext, ResponseContext} from './http'; import { from, Observable } from '../rxjsStub'; -import fetch from "node-fetch"; +import { fetch } from 'undici'; export class IsomorphicFetchHttpLibrary implements HttpLibrary { @@ -13,7 +13,7 @@ export class IsomorphicFetchHttpLibrary implements HttpLibrary { body: body as any, headers: request.getHeaders(), signal: request.getSignal(), - agent: request.getAgent(), + dispatcher: request.getDispatcher(), }).then((resp: any) => { const headers: { [name: string]: string } = {}; resp.headers.forEach((value: string, name: string) => { diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index be458020cd18..6507fe458f38 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -31,9 +31,8 @@ "prepare": "npm run build" }, "dependencies": { - "node-fetch": "^2.7.0", - "@types/node-fetch": "^2.6.13", - "@types/node": "^16.18.126", + "undici": "^7.16.0" + "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" }, From 69a2973ac3def04cd00f50152d0e1cc6f96e0a34 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Nov 2025 00:09:01 -0500 Subject: [PATCH 03/10] missing comma --- .../src/main/resources/typescript/package.mustache | 2 +- samples/client/echo_api/typescript/build/package.json | 2 +- .../client/others/typescript/encode-decode/build/package.json | 2 +- .../client/petstore/typescript/builds/default/package.json | 2 +- .../petstore/typescript/builds/explode-query/package.json | 2 +- .../client/petstore/typescript/builds/inversify/package.json | 2 +- .../petstore/typescript/builds/object_params/package.json | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index 1c67787cd504..0e7b65f1959f 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -46,7 +46,7 @@ {{#fetch-api}} {{#platforms}} {{#node}} - "undici": "^7.16.0" + "undici": "^7.16.0", {{/node}} {{#browser}} "whatwg-fetch": "^3.0.0", diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index 623cf71910fd..e24758c97506 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -31,7 +31,7 @@ "prepare": "npm run build" }, "dependencies": { - "undici": "^7.16.0" + "undici": "^7.16.0", "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" diff --git a/samples/client/others/typescript/encode-decode/build/package.json b/samples/client/others/typescript/encode-decode/build/package.json index 6f5ab8114a6b..6efbdc1e6ad3 100644 --- a/samples/client/others/typescript/encode-decode/build/package.json +++ b/samples/client/others/typescript/encode-decode/build/package.json @@ -31,7 +31,7 @@ "prepare": "npm run build" }, "dependencies": { - "undici": "^7.16.0" + "undici": "^7.16.0", "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index 6507fe458f38..3c6133ffe0a0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -31,7 +31,7 @@ "prepare": "npm run build" }, "dependencies": { - "undici": "^7.16.0" + "undici": "^7.16.0", "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json index 6507fe458f38..3c6133ffe0a0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json @@ -31,7 +31,7 @@ "prepare": "npm run build" }, "dependencies": { - "undici": "^7.16.0" + "undici": "^7.16.0", "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 4185c7b8b23b..82065560b893 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -32,7 +32,7 @@ "prepare": "npm run build" }, "dependencies": { - "undici": "^7.16.0" + "undici": "^7.16.0", "@types/node": "^20.17.10", "form-data": "^4.0.4", "inversify": "^6.0.1", diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index 6507fe458f38..3c6133ffe0a0 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -31,7 +31,7 @@ "prepare": "npm run build" }, "dependencies": { - "undici": "^7.16.0" + "undici": "^7.16.0", "@types/node": "^20.17.10", "form-data": "^4.0.4", "es6-promise": "^4.2.4" From fbfc7b19612e52c2b3594a92e273ed6f6e06e3cc Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Nov 2025 00:30:58 -0500 Subject: [PATCH 04/10] upgrade types in encode test --- .../client/others/typescript/encode-decode/test/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/client/others/typescript/encode-decode/test/package.json b/samples/client/others/typescript/encode-decode/test/package.json index 4e140fe1072e..02450338dfe1 100644 --- a/samples/client/others/typescript/encode-decode/test/package.json +++ b/samples/client/others/typescript/encode-decode/test/package.json @@ -4,7 +4,7 @@ "@openapitools/typescript-encode-decode": "file:../build", "@types/chai": "^4.3.0", "@types/mocha": "^10.0.0", - "@types/node": "^16.6.2", + "@types/node": "^22.12.0", "chai": "^4.3.0", "mocha": "^10.2.0", "ts-node": "^10.9.0", @@ -22,4 +22,4 @@ "author": "", "license": "ISC", "description": "" -} +} \ No newline at end of file From 7de1d3f19994b9d612cfd3dcf1fae5c763712e8f Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Nov 2025 00:36:31 -0500 Subject: [PATCH 05/10] remove EOL node versions, add new LTS --- .github/workflows/samples-typescript-encode-decode.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/samples-typescript-encode-decode.yaml b/.github/workflows/samples-typescript-encode-decode.yaml index 0c3927bb943e..4794e08df42b 100644 --- a/.github/workflows/samples-typescript-encode-decode.yaml +++ b/.github/workflows/samples-typescript-encode-decode.yaml @@ -16,9 +16,9 @@ jobs: # clients - samples/client/others/typescript/encode-decode/test node-version: - - 16 - - 18 - 20 + - 22 + - 24 steps: - uses: actions/checkout@v5 From 4e487474f216546df91e1fa0178fadf2d88642db Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Nov 2025 00:42:08 -0500 Subject: [PATCH 06/10] fix export issue in encode/decode --- .../encode-decode/build/package-lock.json | 303 ++++++++++++------ .../encode-decode/build/package.json | 3 +- .../encode-decode/test/package-lock.json | 25 +- 3 files changed, 226 insertions(+), 105 deletions(-) diff --git a/samples/client/others/typescript/encode-decode/build/package-lock.json b/samples/client/others/typescript/encode-decode/build/package-lock.json index 7748175b5b02..2c38edf5b2db 100644 --- a/samples/client/others/typescript/encode-decode/build/package-lock.json +++ b/samples/client/others/typescript/encode-decode/build/package-lock.json @@ -9,51 +9,42 @@ "version": "1.0.0", "license": "Unlicense", "dependencies": { - "@types/node": "*", - "@types/node-fetch": "^2.5.7", + "@types/node": "^20.17.10", "es6-promise": "^4.2.4", - "form-data": "^2.5.0", - "node-fetch": "^2.6.0" + "form-data": "^4.0.4", + "undici": "^7.16.0" }, "devDependencies": { "typescript": "^4.0" } }, "node_modules/@types/node": { - "version": "22.12.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.12.0.tgz", - "integrity": "sha512-Fll2FZ1riMjNmlmJOdAyY5pUbkftXslB5DgEzlIuNaiWhXd00FhWxVC/r4yV/4wBb9JfImTu+jiSvXTkJ7F/gA==", + "version": "20.19.25", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.25.tgz", + "integrity": "sha512-ZsJzA5thDQMSQO788d7IocwwQbI8B5OPzmqNvpf3NY/+MHDAS759Wo0gd2WQeXYt5AAAQjzcrTVC6SKCuYgoCQ==", + "license": "MIT", "dependencies": { - "undici-types": "~6.20.0" + "undici-types": "~6.21.0" } }, - "node_modules/@types/node-fetch": { - "version": "2.6.12", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.12.tgz", - "integrity": "sha512-8nneRWKCg3rMtF69nLQJnOYUcbafYeFSjqkw3jCRLsqkWFlHaoQrr5mXmofFGOx3DKn7UfmBMyov8ySvLRVldA==", - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.0" - } + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, - "node_modules/@types/node-fetch/node_modules/form-data": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.1.tgz", - "integrity": "sha512-tzN8e4TX8+kkxGPK8D5u0FNmjPUjw3lwC9lSLxxoB/+GtsJG91CO8bSWy73APlgAZzZbXEYZJuxjkHH2w+Ezhw==", + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", "dependencies": { - "asynckit": "^0.4.0", - "combined-stream": "^1.0.8", - "mime-types": "^2.1.12" + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" }, "engines": { - "node": ">= 6" + "node": ">= 0.4" } }, - "node_modules/asynckit": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", - "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" - }, "node_modules/combined-stream": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", @@ -73,23 +64,190 @@ "node": ">=0.4.0" } }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/es6-promise": { "version": "4.2.8", "resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-4.2.8.tgz", "integrity": "sha512-HJDGx5daxeIvxdBxvG2cb9g4tEvwIk3i8+nhX0yGrYmZUzbkdg8QbDevheDB8gd0//uPj4c1EQua8Q+MViT0/w==" }, "node_modules/form-data": { - "version": "2.5.2", - "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.2.tgz", - "integrity": "sha512-GgwY0PS7DbXqajuGf4OYlsrIu3zgxD6Vvql43IBhm6MahqA5SK/7mwhtNj2AdH2z35YR34ujJ7BN+3fFC3jP5Q==", + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.5.tgz", + "integrity": "sha512-8RipRLol37bNs2bhoV67fiTEvdTrbMUYcFTiy3+wuuOnUog2QBHCZWXDRijWQfAkhBj2Uf5UnVaiWwA5vdd82w==", + "license": "MIT", "dependencies": { "asynckit": "^0.4.0", - "combined-stream": "^1.0.6", - "mime-types": "^2.1.12", - "safe-buffer": "^5.2.1" + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.12" }, "engines": { - "node": ">= 0.12" + "node": ">= 6" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "license": "MIT", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" } }, "node_modules/mime-db": { @@ -111,49 +269,6 @@ "node": ">= 0.6" } }, - "node_modules/node-fetch": { - "version": "2.7.0", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.7.0.tgz", - "integrity": "sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==", - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==" - }, "node_modules/typescript": { "version": "4.9.5", "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", @@ -167,24 +282,20 @@ "node": ">=4.2.0" } }, - "node_modules/undici-types": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.20.0.tgz", - "integrity": "sha512-Ny6QZ2Nju20vw1SRHe3d9jVu6gJ+4e3+MMpqu7pqE5HT6WsTSlce++GQmK5UXS8mzV8DSYHrQH+Xrf2jVcuKNg==" - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==" - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==", - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "node_modules/undici": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici/-/undici-7.16.0.tgz", + "integrity": "sha512-QEg3HPMll0o3t2ourKwOeUAZ159Kn9mx5pnzHRQO8+Wixmh88YdZRiIwat0iNzNNXn0yoEtXJqFpyW7eM8BV7g==", + "license": "MIT", + "engines": { + "node": ">=20.18.1" } + }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" } } } diff --git a/samples/client/others/typescript/encode-decode/build/package.json b/samples/client/others/typescript/encode-decode/build/package.json index 6efbdc1e6ad3..35ecc57c6c00 100644 --- a/samples/client/others/typescript/encode-decode/build/package.json +++ b/samples/client/others/typescript/encode-decode/build/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/client/others/typescript/encode-decode/test/package-lock.json b/samples/client/others/typescript/encode-decode/test/package-lock.json index e294ae924b8b..dbffefb71d4f 100644 --- a/samples/client/others/typescript/encode-decode/test/package-lock.json +++ b/samples/client/others/typescript/encode-decode/test/package-lock.json @@ -13,7 +13,7 @@ "@openapitools/typescript-encode-decode": "file:../build", "@types/chai": "^4.3.0", "@types/mocha": "^10.0.0", - "@types/node": "^16.6.2", + "@types/node": "^22.12.0", "chai": "^4.3.0", "mocha": "^10.2.0", "ts-node": "^10.9.0", @@ -25,11 +25,10 @@ "version": "1.0.0", "license": "Unlicense", "dependencies": { - "@types/node": "*", - "@types/node-fetch": "^2.5.7", + "@types/node": "^20.17.10", "es6-promise": "^4.2.4", - "form-data": "^2.5.0", - "node-fetch": "^2.6.0" + "form-data": "^4.0.4", + "undici": "^7.16.0" }, "devDependencies": { "typescript": "^4.0" @@ -103,9 +102,13 @@ "integrity": "sha512-RsOPImTriV/OE4A9qKjMtk2MnXiuLLbcO3nCXK+kvq4nr0iMfFgpjaX3MPLb6f7+EL1FGSelYvuJMV6REH+ZPQ==" }, "node_modules/@types/node": { - "version": "16.18.59", - "resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.59.tgz", - "integrity": "sha512-PJ1w2cNeKUEdey4LiPra0ZuxZFOGvetswE8qHRriV/sUkL5Al4tTmPV9D2+Y/TPIxTHHgxTfRjZVKWhPw/ORhQ==" + "version": "22.19.1", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.19.1.tgz", + "integrity": "sha512-LCCV0HdSZZZb34qifBsyWlUmok6W7ouER+oQIGBScS8EsZsQbrtFTUrDX4hOl+CS6p7cnNC4td+qrSVGSCTUfQ==", + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } }, "node_modules/ansi-colors": { "version": "4.1.1", @@ -1020,6 +1023,12 @@ "node": ">=14.17" } }, + "node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "license": "MIT" + }, "node_modules/v8-compile-cache-lib": { "version": "3.0.1", "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", From 8acbfdabae0af5718a4f73fbeeb9bf446e892619 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Fri, 21 Nov 2025 12:28:44 -0500 Subject: [PATCH 07/10] d.js issue and commonjs module in tsconfig for esm dual support --- .../resources/typescript/package.mustache | 4 +- .../resources/typescript/tsconfig.mustache | 1 + .../echo_api/typescript/build/package.json | 3 +- .../echo_api/typescript/build/tsconfig.json | 1 + .../builds/array-of-lists/package.json | 3 +- .../builds/array-of-lists/tsconfig.json | 1 + .../builds/enum-single-value/package.json | 3 +- .../builds/enum-single-value/tsconfig.json | 1 + .../builds/null-types-simple/package.json | 3 +- .../builds/null-types-simple/tsconfig.json | 1 + .../builds/with-unique-items/package.json | 3 +- .../builds/with-unique-items/tsconfig.json | 1 + .../encode-decode/build/tsconfig.json | 1 + .../encode-decode/test/package.json | 2 +- .../encode-decode/test/tsconfig.json | 37 ++++++++++--------- .../typescript/builds/browser/package.json | 2 +- .../builds/composed-schemas/package.json | 3 +- .../builds/composed-schemas/tsconfig.json | 1 + .../typescript/builds/default/package.json | 3 +- .../typescript/builds/default/tsconfig.json | 1 + .../builds/explode-query/package.json | 3 +- .../builds/explode-query/tsconfig.json | 1 + .../typescript/builds/inversify/package.json | 2 +- .../typescript/builds/jquery/package.json | 3 +- .../typescript/builds/jquery/tsconfig.json | 1 + .../builds/nullable-enum/package.json | 3 +- .../builds/nullable-enum/tsconfig.json | 1 + .../builds/object_params/package.json | 3 +- .../builds/object_params/tsconfig.json | 1 + .../typescript/builds/package-lock.json | 6 +++ .../typescript/tests/package-lock.json | 6 +++ 31 files changed, 70 insertions(+), 35 deletions(-) create mode 100644 samples/openapi3/client/petstore/typescript/builds/package-lock.json create mode 100644 samples/openapi3/client/petstore/typescript/tests/package-lock.json diff --git a/modules/openapi-generator/src/main/resources/typescript/package.mustache b/modules/openapi-generator/src/main/resources/typescript/package.mustache index 0e7b65f1959f..e997a0c645b1 100644 --- a/modules/openapi-generator/src/main/resources/typescript/package.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/package.mustache @@ -24,13 +24,11 @@ {{/supportsES6}} "exports": { ".": { - {{#supportsES6}} "import": "./dist/index.js", - {{/supportsES6}} {{^supportsES6}} "require": "./dist/index.js", {{/supportsES6}} - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache index 894b2ef9d3a0..61ab39eb1556 100644 --- a/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache +++ b/modules/openapi-generator/src/main/resources/typescript/tsconfig.mustache @@ -8,6 +8,7 @@ {{/supportsES6}} {{^supportsES6}} "target": "es5", + "module": "commonjs", {{/supportsES6}} "moduleResolution": "node", "declaration": true, diff --git a/samples/client/echo_api/typescript/build/package.json b/samples/client/echo_api/typescript/build/package.json index e24758c97506..2df36674dca8 100644 --- a/samples/client/echo_api/typescript/build/package.json +++ b/samples/client/echo_api/typescript/build/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/client/echo_api/typescript/build/tsconfig.json b/samples/client/echo_api/typescript/build/tsconfig.json index 953996de3971..c765dce5de53 100644 --- a/samples/client/echo_api/typescript/build/tsconfig.json +++ b/samples/client/echo_api/typescript/build/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/client/others/typescript/builds/array-of-lists/package.json b/samples/client/others/typescript/builds/array-of-lists/package.json index 000e9c5844c4..c8f6a2b429cd 100644 --- a/samples/client/others/typescript/builds/array-of-lists/package.json +++ b/samples/client/others/typescript/builds/array-of-lists/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/client/others/typescript/builds/array-of-lists/tsconfig.json b/samples/client/others/typescript/builds/array-of-lists/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/client/others/typescript/builds/array-of-lists/tsconfig.json +++ b/samples/client/others/typescript/builds/array-of-lists/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/client/others/typescript/builds/enum-single-value/package.json b/samples/client/others/typescript/builds/enum-single-value/package.json index 000e9c5844c4..c8f6a2b429cd 100644 --- a/samples/client/others/typescript/builds/enum-single-value/package.json +++ b/samples/client/others/typescript/builds/enum-single-value/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/client/others/typescript/builds/enum-single-value/tsconfig.json b/samples/client/others/typescript/builds/enum-single-value/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/client/others/typescript/builds/enum-single-value/tsconfig.json +++ b/samples/client/others/typescript/builds/enum-single-value/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/client/others/typescript/builds/null-types-simple/package.json b/samples/client/others/typescript/builds/null-types-simple/package.json index 000e9c5844c4..c8f6a2b429cd 100644 --- a/samples/client/others/typescript/builds/null-types-simple/package.json +++ b/samples/client/others/typescript/builds/null-types-simple/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/client/others/typescript/builds/null-types-simple/tsconfig.json b/samples/client/others/typescript/builds/null-types-simple/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/client/others/typescript/builds/null-types-simple/tsconfig.json +++ b/samples/client/others/typescript/builds/null-types-simple/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/client/others/typescript/builds/with-unique-items/package.json b/samples/client/others/typescript/builds/with-unique-items/package.json index 000e9c5844c4..c8f6a2b429cd 100644 --- a/samples/client/others/typescript/builds/with-unique-items/package.json +++ b/samples/client/others/typescript/builds/with-unique-items/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/client/others/typescript/builds/with-unique-items/tsconfig.json +++ b/samples/client/others/typescript/builds/with-unique-items/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/client/others/typescript/encode-decode/build/tsconfig.json b/samples/client/others/typescript/encode-decode/build/tsconfig.json index 953996de3971..c765dce5de53 100644 --- a/samples/client/others/typescript/encode-decode/build/tsconfig.json +++ b/samples/client/others/typescript/encode-decode/build/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/client/others/typescript/encode-decode/test/package.json b/samples/client/others/typescript/encode-decode/test/package.json index 02450338dfe1..ea563a4d0211 100644 --- a/samples/client/others/typescript/encode-decode/test/package.json +++ b/samples/client/others/typescript/encode-decode/test/package.json @@ -22,4 +22,4 @@ "author": "", "license": "ISC", "description": "" -} \ No newline at end of file +} diff --git a/samples/client/others/typescript/encode-decode/test/tsconfig.json b/samples/client/others/typescript/encode-decode/test/tsconfig.json index e4f8bee09a0b..f26646d00acd 100644 --- a/samples/client/others/typescript/encode-decode/test/tsconfig.json +++ b/samples/client/others/typescript/encode-decode/test/tsconfig.json @@ -1,20 +1,21 @@ { - "compilerOptions": { - "moduleResolution": "node", - "module": "CommonJS", - "target": "ES5", - "noImplicitAny": true, - "sourceMap": false, - "outDir": "dist", - "types": [ - "mocha" - ], - "lib": [ - "es6", - "dom" - ] - }, - "exclude": [ - "node_modules" - ] + "compilerOptions": { + "moduleResolution": "NodeNext", + "module": "NodeNext", + "target": "ES2020", + "noImplicitAny": true, + "sourceMap": false, + "outDir": "dist", + "types": [ + "mocha" + ], + "lib": [ + "es6", + "dom" + ], + "baseUrl": ".", + }, + "exclude": [ + "node_modules" + ] } diff --git a/samples/openapi3/client/petstore/typescript/builds/browser/package.json b/samples/openapi3/client/petstore/typescript/builds/browser/package.json index dec266f420ca..0133eb86c1b7 100644 --- a/samples/openapi3/client/petstore/typescript/builds/browser/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/browser/package.json @@ -20,7 +20,7 @@ "exports": { ".": { "import": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json index f88431483262..6df8f66dc984 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/composed-schemas/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package.json b/samples/openapi3/client/petstore/typescript/builds/default/package.json index 3c6133ffe0a0..afbcb6448ac1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json index 953996de3971..c765dce5de53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json index 3c6133ffe0a0..afbcb6448ac1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json index 953996de3971..c765dce5de53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/explode-query/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json index 82065560b893..48486e8f4ead 100644 --- a/samples/openapi3/client/petstore/typescript/builds/inversify/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/inversify/package.json @@ -20,7 +20,7 @@ "exports": { ".": { "import": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json index 1da818423668..01432e3bf7d6 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/jquery/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json index 000e9c5844c4..c8f6a2b429cd 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/tsconfig.json index d6a3507bd4c5..26c82bc86007 100644 --- a/samples/openapi3/client/petstore/typescript/builds/nullable-enum/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/nullable-enum/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json index 3c6133ffe0a0..afbcb6448ac1 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/package.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/package.json @@ -18,8 +18,9 @@ "type": "commonjs", "exports": { ".": { + "import": "./dist/index.js", "require": "./dist/index.js", - "types": "./dist/index.d.js" + "types": "./dist/index.d.ts" } }, "files": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json index 953996de3971..c765dce5de53 100644 --- a/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json +++ b/samples/openapi3/client/petstore/typescript/builds/object_params/tsconfig.json @@ -3,6 +3,7 @@ "strict": true, /* Basic Options */ "target": "es5", + "module": "commonjs", "moduleResolution": "node", "declaration": true, "typeRoots": [ diff --git a/samples/openapi3/client/petstore/typescript/builds/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/package-lock.json new file mode 100644 index 000000000000..ed368b88ad25 --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/builds/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "builds", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} diff --git a/samples/openapi3/client/petstore/typescript/tests/package-lock.json b/samples/openapi3/client/petstore/typescript/tests/package-lock.json new file mode 100644 index 000000000000..acafab9eaa3a --- /dev/null +++ b/samples/openapi3/client/petstore/typescript/tests/package-lock.json @@ -0,0 +1,6 @@ +{ + "name": "tests", + "lockfileVersion": 3, + "requires": true, + "packages": {} +} From e870c9e8c32ebf88dd072855fbc05afcfab2e52c Mon Sep 17 00:00:00 2001 From: David Gamero Date: Wed, 26 Nov 2025 00:18:21 -0500 Subject: [PATCH 08/10] update samples merge master --- .../ComposedEnum/.openapi-generator/FILES | 5 + .../latest/ComposedEnum/docs/AreaCode.md | 9 - .../ComposedEnum/docs/MarineAreaCode.md | 9 - .../ComposedEnum/docs/StateTerritoryCode.md | 9 - .../latest/ComposedEnum/git_push.sh | 57 -- .../src/Org.OpenAPITools/Client/ApiClient.cs | 822 ------------------ .../Org.OpenAPITools/Client/ApiResponse.cs | 166 ---- .../Org.OpenAPITools/Client/Configuration.cs | 612 ------------- .../Client/ExceptionFactory.cs | 22 - .../Client/GlobalConfiguration.cs | 67 -- .../src/Org.OpenAPITools/Client/HttpMethod.cs | 33 - .../Org.OpenAPITools/Client/IApiAccessor.cs | 37 - .../Client/IAsynchronousClient.cs | 100 --- .../Client/IReadableConfiguration.cs | 141 --- .../Client/ISynchronousClient.cs | 93 -- .../src/Org.OpenAPITools/Client/Multimap.cs | 295 ------- .../Client/OpenAPIDateConverter.cs | 29 - .../Org.OpenAPITools/Client/RequestOptions.cs | 84 -- .../Client/RetryConfiguration.cs | 31 - .../HelloWorld/.openapi-generator/FILES | 4 + .../InlineEnumAnyOf/.openapi-generator/FILES | 7 + .../latest/InlineEnumAnyOf/docs/DefaultApi.md | 97 --- .../latest/InlineEnumAnyOf/docs/Foo.md | 10 - .../docs/IconsDefaultResponse.md | 10 - .../docs/IconsSizeParameter.md | 9 - .../docs/IconsSizeParameterAnyOf.md | 9 - .../latest/OneOfList/.openapi-generator/FILES | 5 + .../OneOfList/docs/OneOfArrayRequest.md | 9 - .../latest/OneOfList/docs/TestObject.md | 10 - .../latest/Tags/.openapi-generator/FILES | 5 + .../latest/Tags/docs/APIKEYSApi.md | 95 -- .../model/ArrayOfArrayOfNumberOnlyTest.java | 51 ++ .../api/impl/AnotherFakeApiServiceImpl.java | 38 + 33 files changed, 115 insertions(+), 2865 deletions(-) delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/AreaCode.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/MarineAreaCode.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/StateTerritoryCode.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/git_push.sh delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiClient.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponse.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Configuration.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionFactory.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/GlobalConfiguration.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/HttpMethod.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IApiAccessor.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IAsynchronousClient.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IReadableConfiguration.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ISynchronousClient.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Multimap.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RequestOptions.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RetryConfiguration.cs delete mode 100644 samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/DefaultApi.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/Foo.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsDefaultResponse.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameter.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameterAnyOf.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/OneOfList/docs/OneOfArrayRequest.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/OneOfList/docs/TestObject.md delete mode 100644 samples/client/petstore/csharp/generichost/latest/Tags/docs/APIKEYSApi.md create mode 100644 samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java create mode 100644 samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES index a0b893ad3a65..b40fe17be173 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -8,7 +9,11 @@ docs/models/MarineAreaCode.md docs/models/StateTerritoryCode.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Model/AreaCodeTests.cs +src/Org.OpenAPITools.Test/Model/MarineAreaCodeTests.cs +src/Org.OpenAPITools.Test/Model/StateTerritoryCodeTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/IApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/AreaCode.md b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/AreaCode.md deleted file mode 100644 index 22a8a1fc30ff..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/AreaCode.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.AreaCode - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/MarineAreaCode.md b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/MarineAreaCode.md deleted file mode 100644 index a101c2273ff6..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/MarineAreaCode.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.MarineAreaCode - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/StateTerritoryCode.md b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/StateTerritoryCode.md deleted file mode 100644 index 1300559945fa..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/docs/StateTerritoryCode.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.StateTerritoryCode - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/git_push.sh b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/git_push.sh deleted file mode 100644 index f53a75d4fabe..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/git_push.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ -# -# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" - -git_user_id=$1 -git_repo_id=$2 -release_note=$3 -git_host=$4 - -if [ "$git_host" = "" ]; then - git_host="github.com" - echo "[INFO] No command line input provided. Set \$git_host to $git_host" -fi - -if [ "$git_user_id" = "" ]; then - git_user_id="GIT_USER_ID" - echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" -fi - -if [ "$git_repo_id" = "" ]; then - git_repo_id="GIT_REPO_ID" - echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" -fi - -if [ "$release_note" = "" ]; then - release_note="Minor update" - echo "[INFO] No command line input provided. Set \$release_note to $release_note" -fi - -# Initialize the local directory as a Git repository -git init - -# Adds the files in the local repository and stages them for commit. -git add . - -# Commits the tracked changes and prepares them to be pushed to a remote repository. -git commit -m "$release_note" - -# Sets the new remote -git_remote=$(git remote) -if [ "$git_remote" = "" ]; then # git remote not defined - - if [ "$GIT_TOKEN" = "" ]; then - echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." - git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git - else - git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git - fi - -fi - -git pull origin master - -# Pushes (Forces) the changes in the local repository up to the remote repository -echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" -git push origin master 2>&1 | grep -v 'To https' diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiClient.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiClient.cs deleted file mode 100644 index 6692a959ac7d..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiClient.cs +++ /dev/null @@ -1,822 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Runtime.Serialization; -using System.Runtime.Serialization.Formatters; -using System.Text; -using System.Threading; -using System.Text.RegularExpressions; -using System.Threading.Tasks; -using Newtonsoft.Json; -using Newtonsoft.Json.Serialization; -using RestSharp; -using RestSharp.Serializers; -using RestSharpMethod = RestSharp.Method; -using FileIO = System.IO.File; -using Polly; -using Org.OpenAPITools.Model; - -namespace Org.OpenAPITools.Client -{ - /// - /// Allows RestSharp to Serialize/Deserialize JSON using our custom logic, but only when ContentType is JSON. - /// - internal class CustomJsonCodec : IRestSerializer, ISerializer, IDeserializer - { - private readonly IReadableConfiguration _configuration; - private readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - public CustomJsonCodec(IReadableConfiguration configuration) - { - _configuration = configuration; - } - - public CustomJsonCodec(JsonSerializerSettings serializerSettings, IReadableConfiguration configuration) - { - _serializerSettings = serializerSettings; - _configuration = configuration; - } - - /// - /// Serialize the object into a JSON string. - /// - /// Object to be serialized. - /// A JSON string. - public string Serialize(object obj) - { - if (obj != null && obj is AbstractOpenAPISchema) - { - // the object to be serialized is an oneOf/anyOf schema - return ((AbstractOpenAPISchema)obj).ToJson(); - } - else - { - return JsonConvert.SerializeObject(obj, _serializerSettings); - } - } - - public string Serialize(Parameter bodyParameter) => Serialize(bodyParameter.Value); - - public T Deserialize(RestResponse response) - { - var result = (T)Deserialize(response, typeof(T)); - return result; - } - - /// - /// Deserialize the JSON string into a proper object. - /// - /// The HTTP response. - /// Object type. - /// Object representation of the JSON string. - internal object Deserialize(RestResponse response, Type type) - { - if (type == typeof(byte[])) // return byte array - { - return response.RawBytes; - } - - // TODO: ? if (type.IsAssignableFrom(typeof(Stream))) - if (type == typeof(Stream)) - { - var bytes = response.RawBytes; - if (response.Headers != null) - { - var filePath = string.IsNullOrEmpty(_configuration.TempFolderPath) - ? global::System.IO.Path.GetTempPath() - : _configuration.TempFolderPath; - var regex = new Regex(@"Content-Disposition=.*filename=['""]?([^'""\s]+)['""]?$"); - foreach (var header in response.Headers) - { - var match = regex.Match(header.ToString()); - if (match.Success) - { - string fileName = filePath + ClientUtils.SanitizeFilename(match.Groups[1].Value.Replace("\"", "").Replace("'", "")); - FileIO.WriteAllBytes(fileName, bytes); - return new FileStream(fileName, FileMode.Open); - } - } - } - var stream = new MemoryStream(bytes); - return stream; - } - - if (type.Name.StartsWith("System.Nullable`1[[System.DateTime")) // return a datetime object - { - return DateTime.Parse(response.Content, null, DateTimeStyles.RoundtripKind); - } - - if (type == typeof(string) || type.Name.StartsWith("System.Nullable")) // return primitive type - { - return Convert.ChangeType(response.Content, type); - } - - // at this point, it must be a model (json) - try - { - return JsonConvert.DeserializeObject(response.Content, type, _serializerSettings); - } - catch (Exception e) - { - throw new ApiException(500, e.Message); - } - } - - public ISerializer Serializer => this; - public IDeserializer Deserializer => this; - - public string[] AcceptedContentTypes => ContentType.JsonAccept; - - public SupportsContentType SupportsContentType => contentType => - contentType.Value.EndsWith("json", StringComparison.InvariantCultureIgnoreCase) || - contentType.Value.EndsWith("javascript", StringComparison.InvariantCultureIgnoreCase); - - public ContentType ContentType { get; set; } = ContentType.Json; - - public DataFormat DataFormat => DataFormat.Json; - } - /// - /// Provides a default implementation of an Api client (both synchronous and asynchronous implementations), - /// encapsulating general REST accessor use cases. - /// - public partial class ApiClient : ISynchronousClient, IAsynchronousClient - { - private readonly string _baseUrl; - - /// - /// Specifies the settings on a object. - /// These settings can be adjusted to accommodate custom serialization rules. - /// - public JsonSerializerSettings SerializerSettings { get; set; } = new JsonSerializerSettings - { - // OpenAPI generated types generally hide default constructors. - ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor, - ContractResolver = new DefaultContractResolver - { - NamingStrategy = new CamelCaseNamingStrategy - { - OverrideSpecifiedNames = false - } - } - }; - - /// - /// Allows for extending request processing for generated code. - /// - /// The RestSharp request object - partial void InterceptRequest(RestRequest request); - - /// - /// Allows for extending response processing for generated code. - /// - /// The RestSharp request object - /// The RestSharp response object - partial void InterceptResponse(RestRequest request, RestResponse response); - - /// - /// Initializes a new instance of the , defaulting to the global configurations' base url. - /// - public ApiClient() - { - _baseUrl = GlobalConfiguration.Instance.BasePath; - } - - /// - /// Initializes a new instance of the - /// - /// The target service's base path in URL format. - /// - public ApiClient(string basePath) - { - if (string.IsNullOrEmpty(basePath)) - throw new ArgumentException("basePath cannot be empty"); - - _baseUrl = basePath; - } - - /// - /// Constructs the RestSharp version of an http method - /// - /// Swagger Client Custom HttpMethod - /// RestSharp's HttpMethod instance. - /// - private RestSharpMethod Method(HttpMethod method) - { - RestSharpMethod other; - switch (method) - { - case HttpMethod.Get: - other = RestSharpMethod.Get; - break; - case HttpMethod.Post: - other = RestSharpMethod.Post; - break; - case HttpMethod.Put: - other = RestSharpMethod.Put; - break; - case HttpMethod.Delete: - other = RestSharpMethod.Delete; - break; - case HttpMethod.Head: - other = RestSharpMethod.Head; - break; - case HttpMethod.Options: - other = RestSharpMethod.Options; - break; - case HttpMethod.Patch: - other = RestSharpMethod.Patch; - break; - default: - throw new ArgumentOutOfRangeException("method", method, null); - } - - return other; - } - - /// - /// Provides all logic for constructing a new RestSharp . - /// At this point, all information for querying the service is known. - /// Here, it is simply mapped into the RestSharp request. - /// - /// The http verb. - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// [private] A new RestRequest instance. - /// - private RestRequest NewRequest( - HttpMethod method, - string path, - RequestOptions options, - IReadableConfiguration configuration) - { - if (path == null) throw new ArgumentNullException("path"); - if (options == null) throw new ArgumentNullException("options"); - if (configuration == null) throw new ArgumentNullException("configuration"); - - RestRequest request = new RestRequest(path, Method(method)); - - if (options.PathParameters != null) - { - foreach (var pathParam in options.PathParameters) - { - request.AddParameter(pathParam.Key, pathParam.Value, ParameterType.UrlSegment); - } - } - - if (options.QueryParameters != null) - { - foreach (var queryParam in options.QueryParameters) - { - foreach (var value in queryParam.Value) - { - request.AddQueryParameter(queryParam.Key, value); - } - } - } - - if (configuration.DefaultHeaders != null) - { - foreach (var headerParam in configuration.DefaultHeaders) - { - request.AddHeader(headerParam.Key, headerParam.Value); - } - } - - if (options.HeaderParameters != null) - { - foreach (var headerParam in options.HeaderParameters) - { - foreach (var value in headerParam.Value) - { - request.AddOrUpdateHeader(headerParam.Key, value); - } - } - } - - if (options.FormParameters != null) - { - foreach (var formParam in options.FormParameters) - { - request.AddParameter(formParam.Key, formParam.Value); - } - } - - if (options.Data != null) - { - if (options.Data is Stream stream) - { - var contentType = "application/octet-stream"; - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - contentType = contentTypes[0]; - } - - var bytes = ClientUtils.ReadAsBytes(stream); - request.AddParameter(contentType, bytes, ParameterType.RequestBody); - } - else - { - if (options.HeaderParameters != null) - { - var contentTypes = options.HeaderParameters["Content-Type"]; - if (contentTypes == null || contentTypes.Any(header => header.Contains("application/json"))) - { - request.RequestFormat = DataFormat.Json; - } - else - { - // TODO: Generated client user should add additional handlers. RestSharp only supports XML and JSON, with XML as default. - } - } - else - { - // Here, we'll assume JSON APIs are more common. XML can be forced by adding produces/consumes to openapi spec explicitly. - request.RequestFormat = DataFormat.Json; - } - - request.AddJsonBody(options.Data); - } - } - - if (options.FileParameters != null) - { - foreach (var fileParam in options.FileParameters) - { - foreach (var file in fileParam.Value) - { - var bytes = ClientUtils.ReadAsBytes(file); - var fileStream = file as FileStream; - if (fileStream != null) - request.AddFile(fileParam.Key, bytes, global::System.IO.Path.GetFileName(fileStream.Name)); - else - request.AddFile(fileParam.Key, bytes, "no_file_name_provided"); - } - } - } - - if (options.HeaderParameters != null) - { - if (options.HeaderParameters.TryGetValue("Content-Type", out var contentTypes) && contentTypes.Any(header => header.Contains("multipart/form-data"))) - { - request.AlwaysMultipartFormData = true; - } - } - - return request; - } - - /// - /// Transforms a RestResponse instance into a new ApiResponse instance. - /// At this point, we have a concrete http response from the service. - /// Here, it is simply mapped into the [public] ApiResponse object. - /// - /// The RestSharp response object - /// A new ApiResponse instance. - private ApiResponse ToApiResponse(RestResponse response) - { - T result = response.Data; - string rawContent = response.Content; - - var transformed = new ApiResponse(response.StatusCode, new Multimap(), result, rawContent) - { - ErrorText = response.ErrorMessage, - Cookies = new List() - }; - - if (response.Headers != null) - { - foreach (var responseHeader in response.Headers) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.ContentHeaders != null) - { - foreach (var responseHeader in response.ContentHeaders) - { - transformed.Headers.Add(responseHeader.Name, ClientUtils.ParameterToString(responseHeader.Value)); - } - } - - if (response.Cookies != null) - { - foreach (var responseCookies in response.Cookies.Cast()) - { - transformed.Cookies.Add( - new Cookie( - responseCookies.Name, - responseCookies.Value, - responseCookies.Path, - responseCookies.Domain) - ); - } - } - - return transformed; - } - - /// - /// Executes the HTTP request for the current service. - /// Based on functions received it can be async or sync. - /// - /// Local function that executes http request and returns http response. - /// Local function to specify options for the service. - /// The RestSharp request object - /// The RestSharp options object - /// A per-request configuration object. - /// It is assumed that any merge with GlobalConfiguration has been done before calling this method. - /// A new ApiResponse instance. - private async Task> ExecClientAsync(Func>> getResponse, Action setOptions, RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - var baseUrl = configuration.GetOperationServerUrl(options.Operation, options.OperationIndex) ?? _baseUrl; - var clientOptions = new RestClientOptions(baseUrl) - { - ClientCertificates = configuration.ClientCertificates, - Timeout = configuration.Timeout, - Proxy = configuration.Proxy, - UserAgent = configuration.UserAgent, - UseDefaultCredentials = configuration.UseDefaultCredentials, - RemoteCertificateValidationCallback = configuration.RemoteCertificateValidationCallback - }; - setOptions(clientOptions); - - using (RestClient client = new RestClient(clientOptions, - configureSerialization: serializerConfig => serializerConfig.UseSerializer(() => new CustomJsonCodec(SerializerSettings, configuration)))) - { - InterceptRequest(request); - - RestResponse response = await getResponse(client).ConfigureAwait(false); - - // if the response type is oneOf/anyOf, call FromJSON to deserialize the data - if (typeof(AbstractOpenAPISchema).IsAssignableFrom(typeof(T))) - { - try - { - response.Data = (T)typeof(T).GetMethod("FromJson").Invoke(null, new object[] { response.Content }); - } - catch (Exception ex) - { - throw ex.InnerException != null ? ex.InnerException : ex; - } - } - else if (typeof(T).Name == "Stream") // for binary response - { - response.Data = (T)(object)new MemoryStream(response.RawBytes); - } - else if (typeof(T).Name == "Byte[]") // for byte response - { - response.Data = (T)(object)response.RawBytes; - } - else if (typeof(T).Name == "String") // for string response - { - response.Data = (T)(object)response.Content; - } - - InterceptResponse(request, response); - - var result = ToApiResponse(response); - if (response.ErrorMessage != null) - { - result.ErrorText = response.ErrorMessage; - } - - if (response.Cookies != null && response.Cookies.Count > 0) - { - if (result.Cookies == null) result.Cookies = new List(); - foreach (var restResponseCookie in response.Cookies.Cast()) - { - var cookie = new Cookie( - restResponseCookie.Name, - restResponseCookie.Value, - restResponseCookie.Path, - restResponseCookie.Domain - ) - { - Comment = restResponseCookie.Comment, - CommentUri = restResponseCookie.CommentUri, - Discard = restResponseCookie.Discard, - Expired = restResponseCookie.Expired, - Expires = restResponseCookie.Expires, - HttpOnly = restResponseCookie.HttpOnly, - Port = restResponseCookie.Port, - Secure = restResponseCookie.Secure, - Version = restResponseCookie.Version - }; - - result.Cookies.Add(cookie); - } - } - return result; - } - } - - private async Task> DeserializeRestResponseFromPolicyAsync(RestClient client, RestRequest request, PolicyResult policyResult, CancellationToken cancellationToken = default) - { - if (policyResult.Outcome == OutcomeType.Successful) - { - return await client.Deserialize(policyResult.Result, cancellationToken).ConfigureAwait(false); - } - else - { - return new RestResponse(request) - { - ErrorException = policyResult.FinalException - }; - } - } - - private ApiResponse Exec(RestRequest request, RequestOptions options, IReadableConfiguration configuration) - { - Action setOptions = (clientOptions) => - { - var cookies = new CookieContainer(); - - if (options.Cookies != null && options.Cookies.Count > 0) - { - foreach (var cookie in options.Cookies) - { - cookies.Add(new Cookie(cookie.Name, cookie.Value)); - } - } - clientOptions.CookieContainer = cookies; - }; - - Func>> getResponse = (client) => - { - if (RetryConfiguration.RetryPolicy != null) - { - var policy = RetryConfiguration.RetryPolicy; - var policyResult = policy.ExecuteAndCapture(() => client.Execute(request)); - return DeserializeRestResponseFromPolicyAsync(client, request, policyResult); - } - else - { - return Task.FromResult(client.Execute(request)); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration).GetAwaiter().GetResult(); - } - - private Task> ExecAsync(RestRequest request, RequestOptions options, IReadableConfiguration configuration, CancellationToken cancellationToken = default) - { - Action setOptions = (clientOptions) => - { - //no extra options - }; - - Func>> getResponse = async (client) => - { - if (RetryConfiguration.AsyncRetryPolicy != null) - { - var policy = RetryConfiguration.AsyncRetryPolicy; - var policyResult = await policy.ExecuteAndCaptureAsync((ct) => client.ExecuteAsync(request, ct), cancellationToken).ConfigureAwait(false); - return await DeserializeRestResponseFromPolicyAsync(client, request, policyResult, cancellationToken).ConfigureAwait(false); - } - else - { - return await client.ExecuteAsync(request, cancellationToken).ConfigureAwait(false); - } - }; - - return ExecClientAsync(getResponse, setOptions, request, options, configuration); - } - - #region IAsynchronousClient - /// - /// Make a HTTP GET request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Get, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP POST request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Post, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PUT request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Put, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP DELETE request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Delete, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP HEAD request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Head, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP OPTION request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Options, path, options, config), options, config, cancellationToken); - } - - /// - /// Make a HTTP PATCH request (async). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// Token that enables callers to cancel the request. - /// A Task containing ApiResponse - public Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, CancellationToken cancellationToken = default) - { - var config = configuration ?? GlobalConfiguration.Instance; - return ExecAsync(NewRequest(HttpMethod.Patch, path, options, config), options, config, cancellationToken); - } - #endregion IAsynchronousClient - - #region ISynchronousClient - /// - /// Make a HTTP GET request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Get, path, options, config), options, config); - } - - /// - /// Make a HTTP POST request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Post, path, options, config), options, config); - } - - /// - /// Make a HTTP PUT request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Put, path, options, config), options, config); - } - - /// - /// Make a HTTP DELETE request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Delete, path, options, config), options, config); - } - - /// - /// Make a HTTP HEAD request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Head, path, options, config), options, config); - } - - /// - /// Make a HTTP OPTION request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Options, path, options, config), options, config); - } - - /// - /// Make a HTTP PATCH request (synchronous). - /// - /// The target path (or resource). - /// The additional request options. - /// A per-request configuration object. It is assumed that any merge with - /// GlobalConfiguration has been done before calling this method. - /// A Task containing ApiResponse - public ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null) - { - var config = configuration ?? GlobalConfiguration.Instance; - return Exec(NewRequest(HttpMethod.Patch, path, options, config), options, config); - } - #endregion ISynchronousClient - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponse.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponse.cs deleted file mode 100644 index 209ec7a756b0..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ApiResponse.cs +++ /dev/null @@ -1,166 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections.Generic; -using System.Net; - -namespace Org.OpenAPITools.Client -{ - /// - /// Provides a non-generic contract for the ApiResponse wrapper. - /// - public interface IApiResponse - { - /// - /// The data type of - /// - Type ResponseType { get; } - - /// - /// The content of this response - /// - Object Content { get; } - - /// - /// Gets or sets the status code (HTTP status code) - /// - /// The status code. - HttpStatusCode StatusCode { get; } - - /// - /// Gets or sets the HTTP headers - /// - /// HTTP headers - Multimap Headers { get; } - - /// - /// Gets or sets any error text defined by the calling client. - /// - string ErrorText { get; set; } - - /// - /// Gets or sets any cookies passed along on the response. - /// - List Cookies { get; set; } - - /// - /// The raw content of this response - /// - string RawContent { get; } - } - - /// - /// API Response - /// - public class ApiResponse : IApiResponse - { - #region Properties - - /// - /// Gets or sets the status code (HTTP status code) - /// - /// The status code. - public HttpStatusCode StatusCode { get; } - - /// - /// Gets or sets the HTTP headers - /// - /// HTTP headers - public Multimap Headers { get; } - - /// - /// Gets or sets the data (parsed HTTP body) - /// - /// The data. - public T Data { get; } - - /// - /// Gets or sets any error text defined by the calling client. - /// - public string ErrorText { get; set; } - - /// - /// Gets or sets any cookies passed along on the response. - /// - public List Cookies { get; set; } - - /// - /// The content of this response - /// - public Type ResponseType - { - get { return typeof(T); } - } - - /// - /// The data type of - /// - public object Content - { - get { return Data; } - } - - /// - /// The raw content - /// - public string RawContent { get; } - - #endregion Properties - - #region Constructors - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// HTTP headers. - /// Data (parsed HTTP body) - /// Raw content. - public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data, string rawContent) - { - StatusCode = statusCode; - Headers = headers; - Data = data; - RawContent = rawContent; - } - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// HTTP headers. - /// Data (parsed HTTP body) - public ApiResponse(HttpStatusCode statusCode, Multimap headers, T data) : this(statusCode, headers, data, null) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// Data (parsed HTTP body) - /// Raw content. - public ApiResponse(HttpStatusCode statusCode, T data, string rawContent) : this(statusCode, null, data, rawContent) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// HTTP status code. - /// Data (parsed HTTP body) - public ApiResponse(HttpStatusCode statusCode, T data) : this(statusCode, data, null) - { - } - - #endregion Constructors - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Configuration.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Configuration.cs deleted file mode 100644 index ca613f33479a..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Configuration.cs +++ /dev/null @@ -1,612 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections.Concurrent; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Reflection; -using System.Security.Cryptography.X509Certificates; -using System.Text; -using System.Net.Http; -using System.Net.Security; - -namespace Org.OpenAPITools.Client -{ - /// - /// Represents a set of configuration settings - /// - public class Configuration : IReadableConfiguration - { - #region Constants - - /// - /// Version of the package. - /// - /// Version of the package. - public const string Version = "1.0.0"; - - /// - /// Identifier for ISO 8601 DateTime Format - /// - /// See https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx#Anchor_8 for more information. - // ReSharper disable once InconsistentNaming - public const string ISO8601_DATETIME_FORMAT = "o"; - - #endregion Constants - - #region Static Members - - /// - /// Default creation of exceptions for a given method name and response object - /// - public static readonly ExceptionFactory DefaultExceptionFactory = (methodName, response) => - { - var status = (int)response.StatusCode; - if (status >= 400) - { - return new ApiException(status, - string.Format("Error calling {0}: {1}", methodName, response.RawContent), - response.RawContent, response.Headers); - } - if (status == 0) - { - return new ApiException(status, - string.Format("Error calling {0}: {1}", methodName, response.ErrorText), response.ErrorText); - } - return null; - }; - - #endregion Static Members - - #region Private Members - - /// - /// Defines the base path of the target API server. - /// Example: http://localhost:3000/v1/ - /// - private string _basePath; - - private bool _useDefaultCredentials = false; - - /// - /// Gets or sets the API key based on the authentication name. - /// This is the key and value comprising the "secret" for accessing an API. - /// - /// The API key. - private IDictionary _apiKey; - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// The prefix of the API key. - private IDictionary _apiKeyPrefix; - - private string _dateTimeFormat = ISO8601_DATETIME_FORMAT; - private string _tempFolderPath = Path.GetTempPath(); - - /// - /// Gets or sets the servers defined in the OpenAPI spec. - /// - /// The servers - private IList> _servers; - - /// - /// Gets or sets the operation servers defined in the OpenAPI spec. - /// - /// The operation servers - private IReadOnlyDictionary>> _operationServers; - - #endregion Private Members - - #region Constructors - - /// - /// Initializes a new instance of the class - /// - [global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] - public Configuration() - { - Proxy = null; - UserAgent = WebUtility.UrlEncode("OpenAPI-Generator/1.0.0/csharp"); - BasePath = "http://localhost"; - DefaultHeaders = new ConcurrentDictionary(); - ApiKey = new ConcurrentDictionary(); - ApiKeyPrefix = new ConcurrentDictionary(); - Servers = new List>() - { - { - new Dictionary { - {"url", ""}, - {"description", "No description provided"}, - } - } - }; - OperationServers = new Dictionary>>() - { - }; - - // Setting Timeout has side effects (forces ApiClient creation). - Timeout = TimeSpan.FromSeconds(100); - } - - /// - /// Initializes a new instance of the class - /// - [global::System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "VirtualMemberCallInConstructor")] - public Configuration( - IDictionary defaultHeaders, - IDictionary apiKey, - IDictionary apiKeyPrefix, - string basePath = "http://localhost") : this() - { - if (string.IsNullOrWhiteSpace(basePath)) - throw new ArgumentException("The provided basePath is invalid.", "basePath"); - if (defaultHeaders == null) - throw new ArgumentNullException("defaultHeaders"); - if (apiKey == null) - throw new ArgumentNullException("apiKey"); - if (apiKeyPrefix == null) - throw new ArgumentNullException("apiKeyPrefix"); - - BasePath = basePath; - - foreach (var keyValuePair in defaultHeaders) - { - DefaultHeaders.Add(keyValuePair); - } - - foreach (var keyValuePair in apiKey) - { - ApiKey.Add(keyValuePair); - } - - foreach (var keyValuePair in apiKeyPrefix) - { - ApiKeyPrefix.Add(keyValuePair); - } - } - - #endregion Constructors - - #region Properties - - /// - /// Gets or sets the base path for API access. - /// - public virtual string BasePath - { - get { return _basePath; } - set { _basePath = value; } - } - - /// - /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. - /// - public virtual bool UseDefaultCredentials - { - get { return _useDefaultCredentials; } - set { _useDefaultCredentials = value; } - } - - /// - /// Gets or sets the default header. - /// - [Obsolete("Use DefaultHeaders instead.")] - public virtual IDictionary DefaultHeader - { - get - { - return DefaultHeaders; - } - set - { - DefaultHeaders = value; - } - } - - /// - /// Gets or sets the default headers. - /// - public virtual IDictionary DefaultHeaders { get; set; } - - /// - /// Gets or sets the HTTP timeout of ApiClient. Defaults to 100 seconds. - /// - public virtual TimeSpan Timeout { get; set; } - - /// - /// Gets or sets the proxy - /// - /// Proxy. - public virtual WebProxy Proxy { get; set; } - - /// - /// Gets or sets the HTTP user agent. - /// - /// Http user agent. - public virtual string UserAgent { get; set; } - - /// - /// Gets or sets the username (HTTP basic authentication). - /// - /// The username. - public virtual string Username { get; set; } - - /// - /// Gets or sets the password (HTTP basic authentication). - /// - /// The password. - public virtual string Password { get; set; } - - /// - /// Gets the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - public string GetApiKeyWithPrefix(string apiKeyIdentifier) - { - string apiKeyValue; - ApiKey.TryGetValue(apiKeyIdentifier, out apiKeyValue); - string apiKeyPrefix; - if (ApiKeyPrefix.TryGetValue(apiKeyIdentifier, out apiKeyPrefix)) - { - return apiKeyPrefix + " " + apiKeyValue; - } - - return apiKeyValue; - } - - /// - /// Gets or sets certificate collection to be sent with requests. - /// - /// X509 Certificate collection. - public X509CertificateCollection ClientCertificates { get; set; } - - /// - /// Gets or sets the access token for OAuth2 authentication. - /// - /// This helper property simplifies code generation. - /// - /// The access token. - public virtual string AccessToken { get; set; } - - /// - /// Gets or sets the temporary folder path to store the files downloaded from the server. - /// - /// Folder path. - public virtual string TempFolderPath - { - get { return _tempFolderPath; } - - set - { - if (string.IsNullOrEmpty(value)) - { - _tempFolderPath = Path.GetTempPath(); - return; - } - - // create the directory if it does not exist - if (!Directory.Exists(value)) - { - Directory.CreateDirectory(value); - } - - // check if the path contains directory separator at the end - if (value[value.Length - 1] == Path.DirectorySeparatorChar) - { - _tempFolderPath = value; - } - else - { - _tempFolderPath = value + Path.DirectorySeparatorChar; - } - } - } - - /// - /// Gets or sets the date time format used when serializing in the ApiClient - /// By default, it's set to ISO 8601 - "o", for others see: - /// https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx - /// and https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx - /// No validation is done to ensure that the string you're providing is valid - /// - /// The DateTimeFormat string - public virtual string DateTimeFormat - { - get { return _dateTimeFormat; } - set - { - if (string.IsNullOrEmpty(value)) - { - // Never allow a blank or null string, go back to the default - _dateTimeFormat = ISO8601_DATETIME_FORMAT; - return; - } - - // Caution, no validation when you choose date time format other than ISO 8601 - // Take a look at the above links - _dateTimeFormat = value; - } - } - - /// - /// Gets or sets the prefix (e.g. Token) of the API key based on the authentication name. - /// - /// Whatever you set here will be prepended to the value defined in AddApiKey. - /// - /// An example invocation here might be: - /// - /// ApiKeyPrefix["Authorization"] = "Bearer"; - /// - /// … where ApiKey["Authorization"] would then be used to set the value of your bearer token. - /// - /// - /// OAuth2 workflows should set tokens via AccessToken. - /// - /// - /// The prefix of the API key. - public virtual IDictionary ApiKeyPrefix - { - get { return _apiKeyPrefix; } - set - { - if (value == null) - { - throw new InvalidOperationException("ApiKeyPrefix collection may not be null."); - } - _apiKeyPrefix = value; - } - } - - /// - /// Gets or sets the API key based on the authentication name. - /// - /// The API key. - public virtual IDictionary ApiKey - { - get { return _apiKey; } - set - { - if (value == null) - { - throw new InvalidOperationException("ApiKey collection may not be null."); - } - _apiKey = value; - } - } - - /// - /// Gets or sets the servers. - /// - /// The servers. - public virtual IList> Servers - { - get { return _servers; } - set - { - if (value == null) - { - throw new InvalidOperationException("Servers may not be null."); - } - _servers = value; - } - } - - /// - /// Gets or sets the operation servers. - /// - /// The operation servers. - public virtual IReadOnlyDictionary>> OperationServers - { - get { return _operationServers; } - set - { - if (value == null) - { - throw new InvalidOperationException("Operation servers may not be null."); - } - _operationServers = value; - } - } - - /// - /// Returns URL based on server settings without providing values - /// for the variables - /// - /// Array index of the server settings. - /// The server URL. - public string GetServerUrl(int index) - { - return GetServerUrl(Servers, index, null); - } - - /// - /// Returns URL based on server settings. - /// - /// Array index of the server settings. - /// Dictionary of the variables and the corresponding values. - /// The server URL. - public string GetServerUrl(int index, Dictionary inputVariables) - { - return GetServerUrl(Servers, index, inputVariables); - } - - /// - /// Returns URL based on operation server settings. - /// - /// Operation associated with the request path. - /// Array index of the server settings. - /// The operation server URL. - public string GetOperationServerUrl(string operation, int index) - { - return GetOperationServerUrl(operation, index, null); - } - - /// - /// Returns URL based on operation server settings. - /// - /// Operation associated with the request path. - /// Array index of the server settings. - /// Dictionary of the variables and the corresponding values. - /// The operation server URL. - public string GetOperationServerUrl(string operation, int index, Dictionary inputVariables) - { - if (operation != null && OperationServers.TryGetValue(operation, out var operationServer)) - { - return GetServerUrl(operationServer, index, inputVariables); - } - - return null; - } - - /// - /// Returns URL based on server settings. - /// - /// Dictionary of server settings. - /// Array index of the server settings. - /// Dictionary of the variables and the corresponding values. - /// The server URL. - private string GetServerUrl(IList> servers, int index, Dictionary inputVariables) - { - if (index < 0 || index >= servers.Count) - { - throw new InvalidOperationException($"Invalid index {index} when selecting the server. Must be less than {servers.Count}."); - } - - if (inputVariables == null) - { - inputVariables = new Dictionary(); - } - - IReadOnlyDictionary server = servers[index]; - string url = (string)server["url"]; - - if (server.ContainsKey("variables")) - { - // go through each variable and assign a value - foreach (KeyValuePair variable in (IReadOnlyDictionary)server["variables"]) - { - - IReadOnlyDictionary serverVariables = (IReadOnlyDictionary)(variable.Value); - - if (inputVariables.ContainsKey(variable.Key)) - { - if (!serverVariables.ContainsKey("enum_values") || ((List)serverVariables["enum_values"]).Contains(inputVariables[variable.Key])) - { - url = url.Replace("{" + variable.Key + "}", inputVariables[variable.Key]); - } - else - { - throw new InvalidOperationException($"The variable `{variable.Key}` in the server URL has invalid value #{inputVariables[variable.Key]}. Must be {(List)serverVariables["enum_values"]}"); - } - } - else - { - // use default value - url = url.Replace("{" + variable.Key + "}", (string)serverVariables["default_value"]); - } - } - } - - return url; - } - - /// - /// Gets and Sets the RemoteCertificateValidationCallback - /// - public RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; set; } - - #endregion Properties - - #region Methods - - /// - /// Returns a string with essential information for debugging. - /// - public static string ToDebugReport() - { - string report = "C# SDK (Org.OpenAPITools) Debug Report:\n"; - report += " OS: " + System.Environment.OSVersion + "\n"; - report += " .NET Framework Version: " + System.Environment.Version + "\n"; - report += " Version of the API: 0.0.1\n"; - report += " SDK Package Version: 1.0.0\n"; - - return report; - } - - /// - /// Add Api Key Header. - /// - /// Api Key name. - /// Api Key value. - /// - public void AddApiKey(string key, string value) - { - ApiKey[key] = value; - } - - /// - /// Sets the API key prefix. - /// - /// Api Key name. - /// Api Key value. - public void AddApiKeyPrefix(string key, string value) - { - ApiKeyPrefix[key] = value; - } - - #endregion Methods - - #region Static Members - /// - /// Merge configurations. - /// - /// First configuration. - /// Second configuration. - /// Merged configuration. - public static IReadableConfiguration MergeConfigurations(IReadableConfiguration first, IReadableConfiguration second) - { - if (second == null) return first ?? GlobalConfiguration.Instance; - - Dictionary apiKey = first.ApiKey.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - Dictionary apiKeyPrefix = first.ApiKeyPrefix.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - Dictionary defaultHeaders = first.DefaultHeaders.ToDictionary(kvp => kvp.Key, kvp => kvp.Value); - - foreach (var kvp in second.ApiKey) apiKey[kvp.Key] = kvp.Value; - foreach (var kvp in second.ApiKeyPrefix) apiKeyPrefix[kvp.Key] = kvp.Value; - foreach (var kvp in second.DefaultHeaders) defaultHeaders[kvp.Key] = kvp.Value; - - var config = new Configuration - { - ApiKey = apiKey, - ApiKeyPrefix = apiKeyPrefix, - DefaultHeaders = defaultHeaders, - BasePath = second.BasePath ?? first.BasePath, - Timeout = second.Timeout, - Proxy = second.Proxy ?? first.Proxy, - UserAgent = second.UserAgent ?? first.UserAgent, - Username = second.Username ?? first.Username, - Password = second.Password ?? first.Password, - AccessToken = second.AccessToken ?? first.AccessToken, - TempFolderPath = second.TempFolderPath ?? first.TempFolderPath, - DateTimeFormat = second.DateTimeFormat ?? first.DateTimeFormat, - ClientCertificates = second.ClientCertificates ?? first.ClientCertificates, - UseDefaultCredentials = second.UseDefaultCredentials, - RemoteCertificateValidationCallback = second.RemoteCertificateValidationCallback ?? first.RemoteCertificateValidationCallback, - }; - return config; - } - #endregion Static Members - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionFactory.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionFactory.cs deleted file mode 100644 index 3a61ce471477..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ExceptionFactory.cs +++ /dev/null @@ -1,22 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// A delegate to ExceptionFactory method - /// - /// Method name - /// Response - /// Exceptions - public delegate Exception ExceptionFactory(string methodName, IApiResponse response); -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/GlobalConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/GlobalConfiguration.cs deleted file mode 100644 index f219e438f298..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/GlobalConfiguration.cs +++ /dev/null @@ -1,67 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System.Collections.Generic; - -namespace Org.OpenAPITools.Client -{ - /// - /// provides a compile-time extension point for globally configuring - /// API Clients. - /// - /// - /// A customized implementation via partial class may reside in another file and may - /// be excluded from automatic generation via a .openapi-generator-ignore file. - /// - public partial class GlobalConfiguration : Configuration - { - #region Private Members - - private static readonly object GlobalConfigSync = new { }; - private static IReadableConfiguration _globalConfiguration; - - #endregion Private Members - - #region Constructors - - /// - private GlobalConfiguration() - { - } - - /// - public GlobalConfiguration(IDictionary defaultHeader, IDictionary apiKey, IDictionary apiKeyPrefix, string basePath = "http://localhost:3000/api") : base(defaultHeader, apiKey, apiKeyPrefix, basePath) - { - } - - static GlobalConfiguration() - { - Instance = new GlobalConfiguration(); - } - - #endregion Constructors - - /// - /// Gets or sets the default Configuration. - /// - /// Configuration. - public static IReadableConfiguration Instance - { - get { return _globalConfiguration; } - set - { - lock (GlobalConfigSync) - { - _globalConfiguration = value; - } - } - } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/HttpMethod.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/HttpMethod.cs deleted file mode 100644 index a75667402126..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/HttpMethod.cs +++ /dev/null @@ -1,33 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -namespace Org.OpenAPITools.Client -{ - /// - /// Http methods supported by swagger - /// - public enum HttpMethod - { - /// HTTP GET request. - Get, - /// HTTP POST request. - Post, - /// HTTP PUT request. - Put, - /// HTTP DELETE request. - Delete, - /// HTTP HEAD request. - Head, - /// HTTP OPTIONS request. - Options, - /// HTTP PATCH request. - Patch - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IApiAccessor.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IApiAccessor.cs deleted file mode 100644 index 9b68a8eea13a..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IApiAccessor.cs +++ /dev/null @@ -1,37 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; - -namespace Org.OpenAPITools.Client -{ - /// - /// Represents configuration aspects required to interact with the API endpoints. - /// - public interface IApiAccessor - { - /// - /// Gets or sets the configuration object - /// - /// An instance of the Configuration - IReadableConfiguration Configuration { get; set; } - - /// - /// Gets the base path of the API client. - /// - /// The base path - string GetBasePath(); - - /// - /// Provides a factory method hook for the creation of exceptions. - /// - ExceptionFactory ExceptionFactory { get; set; } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IAsynchronousClient.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IAsynchronousClient.cs deleted file mode 100644 index eb8a8de76ff8..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IAsynchronousClient.cs +++ /dev/null @@ -1,100 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Threading.Tasks; - -namespace Org.OpenAPITools.Client -{ - /// - /// Contract for Asynchronous RESTful API interactions. - /// - /// This interface allows consumers to provide a custom API accessor client. - /// - public interface IAsynchronousClient - { - /// - /// Executes a non-blocking call to some using the GET http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> GetAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Executes a non-blocking call to some using the POST http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> PostAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Executes a non-blocking call to some using the PUT http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> PutAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Executes a non-blocking call to some using the DELETE http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> DeleteAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Executes a non-blocking call to some using the HEAD http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> HeadAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Executes a non-blocking call to some using the OPTIONS http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> OptionsAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - - /// - /// Executes a non-blocking call to some using the PATCH http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// Cancellation Token to cancel the request. - /// The return type. - /// A task eventually representing the response data, decorated with - Task> PatchAsync(string path, RequestOptions options, IReadableConfiguration configuration = null, System.Threading.CancellationToken cancellationToken = default); - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IReadableConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IReadableConfiguration.cs deleted file mode 100644 index c246e94a8d26..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/IReadableConfiguration.cs +++ /dev/null @@ -1,141 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections.Generic; -using System.Net; -using System.Net.Security; -using System.Security.Cryptography.X509Certificates; - -namespace Org.OpenAPITools.Client -{ - /// - /// Represents a readable-only configuration contract. - /// - public interface IReadableConfiguration - { - /// - /// Gets the access token. - /// - /// Access token. - string AccessToken { get; } - - /// - /// Gets the API key. - /// - /// API key. - IDictionary ApiKey { get; } - - /// - /// Gets the API key prefix. - /// - /// API key prefix. - IDictionary ApiKeyPrefix { get; } - - /// - /// Gets the base path. - /// - /// Base path. - string BasePath { get; } - - /// - /// Gets the date time format. - /// - /// Date time format. - string DateTimeFormat { get; } - - /// - /// Gets the default header. - /// - /// Default header. - [Obsolete("Use DefaultHeaders instead.")] - IDictionary DefaultHeader { get; } - - /// - /// Gets the default headers. - /// - /// Default headers. - IDictionary DefaultHeaders { get; } - - /// - /// Gets the temp folder path. - /// - /// Temp folder path. - string TempFolderPath { get; } - - /// - /// Gets the HTTP connection timeout. - /// - /// HTTP connection timeout. - TimeSpan Timeout { get; } - - /// - /// Gets the proxy. - /// - /// Proxy. - WebProxy Proxy { get; } - - /// - /// Gets the user agent. - /// - /// User agent. - string UserAgent { get; } - - /// - /// Gets the username. - /// - /// Username. - string Username { get; } - - /// - /// Gets the password. - /// - /// Password. - string Password { get; } - - /// - /// Determine whether or not the "default credentials" (e.g. the user account under which the current process is running) will be sent along to the server. The default is false. - /// - bool UseDefaultCredentials { get; } - - /// - /// Get the servers associated with the operation. - /// - /// Operation servers. - IReadOnlyDictionary>> OperationServers { get; } - - /// - /// Gets the API key with prefix. - /// - /// API key identifier (authentication scheme). - /// API key with prefix. - string GetApiKeyWithPrefix(string apiKeyIdentifier); - - /// - /// Gets the Operation server url at the provided index. - /// - /// Operation server name. - /// Index of the operation server settings. - /// - string GetOperationServerUrl(string operation, int index); - - /// - /// Gets certificate collection to be sent with requests. - /// - /// X509 Certificate collection. - X509CertificateCollection ClientCertificates { get; } - - /// - /// Callback function for handling the validation of remote certificates. Useful for certificate pinning and - /// overriding certificate errors in the scope of a request. - /// - RemoteCertificateValidationCallback RemoteCertificateValidationCallback { get; } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ISynchronousClient.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ISynchronousClient.cs deleted file mode 100644 index 9c9bd9ae809a..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/ISynchronousClient.cs +++ /dev/null @@ -1,93 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.IO; - -namespace Org.OpenAPITools.Client -{ - /// - /// Contract for Synchronous RESTful API interactions. - /// - /// This interface allows consumers to provide a custom API accessor client. - /// - public interface ISynchronousClient - { - /// - /// Executes a blocking call to some using the GET http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Get(string path, RequestOptions options, IReadableConfiguration configuration = null); - - /// - /// Executes a blocking call to some using the POST http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Post(string path, RequestOptions options, IReadableConfiguration configuration = null); - - /// - /// Executes a blocking call to some using the PUT http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Put(string path, RequestOptions options, IReadableConfiguration configuration = null); - - /// - /// Executes a blocking call to some using the DELETE http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Delete(string path, RequestOptions options, IReadableConfiguration configuration = null); - - /// - /// Executes a blocking call to some using the HEAD http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Head(string path, RequestOptions options, IReadableConfiguration configuration = null); - - /// - /// Executes a blocking call to some using the OPTIONS http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Options(string path, RequestOptions options, IReadableConfiguration configuration = null); - - /// - /// Executes a blocking call to some using the PATCH http verb. - /// - /// The relative path to invoke. - /// The request parameters to pass along to the client. - /// Per-request configurable settings. - /// The return type. - /// The response data, decorated with - ApiResponse Patch(string path, RequestOptions options, IReadableConfiguration configuration = null); - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Multimap.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Multimap.cs deleted file mode 100644 index 71d7880724da..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/Multimap.cs +++ /dev/null @@ -1,295 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Org.OpenAPITools.Client -{ - /// - /// A dictionary in which one key has many associated values. - /// - /// The type of the key - /// The type of the value associated with the key. - public class Multimap : IDictionary> - { - #region Private Fields - - private readonly Dictionary> _dictionary; - - #endregion Private Fields - - #region Constructors - - /// - /// Empty Constructor. - /// - public Multimap() - { - _dictionary = new Dictionary>(); - } - - /// - /// Constructor with comparer. - /// - /// - public Multimap(IEqualityComparer comparer) - { - _dictionary = new Dictionary>(comparer); - } - - #endregion Constructors - - #region Enumerators - - /// - /// To get the enumerator. - /// - /// Enumerator - public IEnumerator>> GetEnumerator() - { - return _dictionary.GetEnumerator(); - } - - /// - /// To get the enumerator. - /// - /// Enumerator - IEnumerator IEnumerable.GetEnumerator() - { - return _dictionary.GetEnumerator(); - } - - #endregion Enumerators - - #region Public Members - /// - /// Add values to Multimap - /// - /// Key value pair - public void Add(KeyValuePair> item) - { - if (!TryAdd(item.Key, item.Value)) - throw new InvalidOperationException("Could not add values to Multimap."); - } - - /// - /// Add Multimap to Multimap - /// - /// Multimap - public void Add(Multimap multimap) - { - foreach (var item in multimap) - { - if (!TryAdd(item.Key, item.Value)) - throw new InvalidOperationException("Could not add values to Multimap."); - } - } - - /// - /// Clear Multimap - /// - public void Clear() - { - _dictionary.Clear(); - } - - /// - /// Determines whether Multimap contains the specified item. - /// - /// Key value pair - /// Method needs to be implemented - /// true if the Multimap contains the item; otherwise, false. - public bool Contains(KeyValuePair> item) - { - throw new NotImplementedException(); - } - - /// - /// Copy items of the Multimap to an array, - /// starting at a particular array index. - /// - /// The array that is the destination of the items copied - /// from Multimap. The array must have zero-based indexing. - /// The zero-based index in array at which copying begins. - /// Method needs to be implemented - public void CopyTo(KeyValuePair>[] array, int arrayIndex) - { - throw new NotImplementedException(); - } - - /// - /// Removes the specified item from the Multimap. - /// - /// Key value pair - /// true if the item is successfully removed; otherwise, false. - /// Method needs to be implemented - public bool Remove(KeyValuePair> item) - { - throw new NotImplementedException(); - } - - /// - /// Gets the number of items contained in the Multimap. - /// - public int Count => _dictionary.Count; - - /// - /// Gets a value indicating whether the Multimap is read-only. - /// - public bool IsReadOnly => false; - - /// - /// Adds an item with the provided key and value to the Multimap. - /// - /// The object to use as the key of the item to add. - /// The object to use as the value of the item to add. - /// Thrown when couldn't add the value to Multimap. - public void Add(TKey key, IList value) - { - if (value != null && value.Count > 0) - { - if (_dictionary.TryGetValue(key, out var list)) - { - foreach (var k in value) list.Add(k); - } - else - { - list = new List(value); - if (!TryAdd(key, list)) - throw new InvalidOperationException("Could not add values to Multimap."); - } - } - } - - /// - /// Determines whether the Multimap contains an item with the specified key. - /// - /// The key to locate in the Multimap. - /// true if the Multimap contains an item with - /// the key; otherwise, false. - public bool ContainsKey(TKey key) - { - return _dictionary.ContainsKey(key); - } - - /// - /// Removes item with the specified key from the Multimap. - /// - /// The key to locate in the Multimap. - /// true if the item is successfully removed; otherwise, false. - public bool Remove(TKey key) - { - return TryRemove(key, out var _); - } - - /// - /// Gets the value associated with the specified key. - /// - /// The key whose value to get. - /// When this method returns, the value associated with the specified key, if the - /// key is found; otherwise, the default value for the type of the value parameter. - /// This parameter is passed uninitialized. - /// true if the object that implements Multimap contains - /// an item with the specified key; otherwise, false. - public bool TryGetValue(TKey key, out IList value) - { - return _dictionary.TryGetValue(key, out value); - } - - /// - /// Gets or sets the item with the specified key. - /// - /// The key of the item to get or set. - /// The value of the specified key. - public IList this[TKey key] - { - get => _dictionary[key]; - set => _dictionary[key] = value; - } - - /// - /// Gets a System.Collections.Generic.ICollection containing the keys of the Multimap. - /// - public ICollection Keys => _dictionary.Keys; - - /// - /// Gets a System.Collections.Generic.ICollection containing the values of the Multimap. - /// - public ICollection> Values => _dictionary.Values; - - /// - /// Copy the items of the Multimap to an System.Array, - /// starting at a particular System.Array index. - /// - /// The one-dimensional System.Array that is the destination of the items copied - /// from Multimap. The System.Array must have zero-based indexing. - /// The zero-based index in array at which copying begins. - public void CopyTo(Array array, int index) - { - ((ICollection)_dictionary).CopyTo(array, index); - } - - /// - /// Adds an item with the provided key and value to the Multimap. - /// - /// The object to use as the key of the item to add. - /// The object to use as the value of the item to add. - /// Thrown when couldn't add value to Multimap. - public void Add(TKey key, TValue value) - { - if (value != null) - { - if (_dictionary.TryGetValue(key, out var list)) - { - list.Add(value); - } - else - { - list = new List { value }; - if (!TryAdd(key, list)) - throw new InvalidOperationException("Could not add value to Multimap."); - } - } - } - - #endregion Public Members - - #region Private Members - - /** - * Helper method to encapsulate generator differences between dictionary types. - */ - private bool TryRemove(TKey key, out IList value) - { - _dictionary.TryGetValue(key, out value); - return _dictionary.Remove(key); - } - - /** - * Helper method to encapsulate generator differences between dictionary types. - */ - private bool TryAdd(TKey key, IList value) - { - try - { - _dictionary.Add(key, value); - } - catch (ArgumentException) - { - return false; - } - - return true; - } - #endregion Private Members - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs deleted file mode 100644 index c028647ab009..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/OpenAPIDateConverter.cs +++ /dev/null @@ -1,29 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - -using Newtonsoft.Json.Converters; - -namespace Org.OpenAPITools.Client -{ - /// - /// Formatter for 'date' openapi formats ss defined by full-date - RFC3339 - /// see https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.0.md#data-types - /// - public class OpenAPIDateConverter : IsoDateTimeConverter - { - /// - /// Initializes a new instance of the class. - /// - public OpenAPIDateConverter() - { - // full-date = date-fullyear "-" date-month "-" date-mday - DateTimeFormat = "yyyy-MM-dd"; - } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RequestOptions.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RequestOptions.cs deleted file mode 100644 index 8f3dfd1455c4..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RequestOptions.cs +++ /dev/null @@ -1,84 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using System; -using System.Collections.Generic; -using System.IO; -using System.Net; - -namespace Org.OpenAPITools.Client -{ - /// - /// A container for generalized request inputs. This type allows consumers to extend the request functionality - /// by abstracting away from the default (built-in) request framework (e.g. RestSharp). - /// - public class RequestOptions - { - /// - /// Parameters to be bound to path parts of the Request's URL - /// - public Dictionary PathParameters { get; set; } - - /// - /// Query parameters to be applied to the request. - /// Keys may have 1 or more values associated. - /// - public Multimap QueryParameters { get; set; } - - /// - /// Header parameters to be applied to the request. - /// Keys may have 1 or more values associated. - /// - public Multimap HeaderParameters { get; set; } - - /// - /// Form parameters to be sent along with the request. - /// - public Dictionary FormParameters { get; set; } - - /// - /// File parameters to be sent along with the request. - /// - public Multimap FileParameters { get; set; } - - /// - /// Cookies to be sent along with the request. - /// - public List Cookies { get; set; } - - /// - /// Operation associated with the request path. - /// - public string Operation { get; set; } - - /// - /// Index associated with the operation. - /// - public int OperationIndex { get; set; } - - /// - /// Any data associated with a request body. - /// - public Object Data { get; set; } - - /// - /// Constructs a new instance of - /// - public RequestOptions() - { - PathParameters = new Dictionary(); - QueryParameters = new Multimap(); - HeaderParameters = new Multimap(); - FormParameters = new Dictionary(); - FileParameters = new Multimap(); - Cookies = new List(); - } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RetryConfiguration.cs b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RetryConfiguration.cs deleted file mode 100644 index 4e19a59f6188..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/src/Org.OpenAPITools/Client/RetryConfiguration.cs +++ /dev/null @@ -1,31 +0,0 @@ -/* - * OpenAPI - * - * OpenAPI - * - * The version of the OpenAPI document: 0.0.1 - * Generated by: https://github.com/openapitools/openapi-generator.git - */ - - -using Polly; -using RestSharp; - -namespace Org.OpenAPITools.Client -{ - /// - /// Configuration class to set the polly retry policies to be applied to the requests. - /// - public static class RetryConfiguration - { - /// - /// Retry policy - /// - public static ISyncPolicy RetryPolicy { get; set; } - - /// - /// Async retry policy - /// - public static IAsyncPolicy AsyncRetryPolicy { get; set; } - } -} diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES index 479e2c02cc5c..f5c94a57e68d 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -7,7 +8,10 @@ docs/apis/DefaultApi.md docs/models/HelloWorldPostRequest.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Model/HelloWorldPostRequestTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/DefaultApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES index 8f168c503eca..2afdf46bf821 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -10,7 +11,13 @@ docs/models/IconsSizeParameter.md docs/models/IconsSizeParameterAnyOf.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Model/FooTests.cs +src/Org.OpenAPITools.Test/Model/IconsDefaultResponseTests.cs +src/Org.OpenAPITools.Test/Model/IconsSizeParameterAnyOfTests.cs +src/Org.OpenAPITools.Test/Model/IconsSizeParameterTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/DefaultApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/DefaultApi.md b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/DefaultApi.md deleted file mode 100644 index ecfa61597713..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/DefaultApi.md +++ /dev/null @@ -1,97 +0,0 @@ -# Org.OpenAPITools.Api.DefaultApi - -All URIs are relative to *http://petstore.swagger.io:80/v2* - -| Method | HTTP request | Description | -|--------|--------------|-------------| -| [**Icons**](DefaultApi.md#icons) | **GET** /icons | | - - -# **Icons** -> IconsDefaultResponse Icons (IconsSizeParameter? size = null) - - - -Returns a forecast icon. Icon services in API are deprecated. - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Model; - -namespace Example -{ - public class IconsExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://petstore.swagger.io:80/v2"; - var apiInstance = new DefaultApi(config); - var size = new IconsSizeParameter?(); // IconsSizeParameter? | Font size (optional) - - try - { - IconsDefaultResponse result = apiInstance.Icons(size); - Debug.WriteLine(result); - } - catch (ApiException e) - { - Debug.Print("Exception when calling DefaultApi.Icons: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the IconsWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - ApiResponse response = apiInstance.IconsWithHttpInfo(size); - Debug.Write("Status Code: " + response.StatusCode); - Debug.Write("Response Headers: " + response.Headers); - Debug.Write("Response Body: " + response.Data); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling DefaultApi.IconsWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **size** | [**IconsSizeParameter?**](IconsSizeParameter?.md) | Font size | [optional] | - -### Return type - -[**IconsDefaultResponse**](IconsDefaultResponse.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **0** | response | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/Foo.md b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/Foo.md deleted file mode 100644 index 92cf45723210..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/Foo.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.Foo - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Bar** | **string** | | [optional] [default to "bar"] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsDefaultResponse.md b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsDefaultResponse.md deleted file mode 100644 index c747d1a784af..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsDefaultResponse.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.IconsDefaultResponse - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**String** | [**Foo**](Foo.md) | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameter.md b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameter.md deleted file mode 100644 index 3be5f82c2fdf..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameter.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.IconsSizeParameter - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameterAnyOf.md b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameterAnyOf.md deleted file mode 100644 index b6977bebb568..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/docs/IconsSizeParameterAnyOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.IconsSizeParameterAnyOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES index c3094ea1e371..e8ae0e72888c 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -8,7 +9,11 @@ docs/models/OneOfArrayRequest.md docs/models/TestObject.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs +src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs +src/Org.OpenAPITools.Test/Model/OneOfArrayRequestTests.cs +src/Org.OpenAPITools.Test/Model/TestObjectTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/DefaultApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/docs/OneOfArrayRequest.md b/samples/client/petstore/csharp/generichost/latest/OneOfList/docs/OneOfArrayRequest.md deleted file mode 100644 index 30d7195fdbf6..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/docs/OneOfArrayRequest.md +++ /dev/null @@ -1,9 +0,0 @@ -# Org.OpenAPITools.Model.OneOfArrayRequest - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/docs/TestObject.md b/samples/client/petstore/csharp/generichost/latest/OneOfList/docs/TestObject.md deleted file mode 100644 index d1ee8bbc3b32..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/docs/TestObject.md +++ /dev/null @@ -1,10 +0,0 @@ -# Org.OpenAPITools.Model.TestObject - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**Name** | **string** | | [optional] - -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES index b08037a54926..befba8a8e36e 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES @@ -1,4 +1,5 @@ .gitignore +.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -8,6 +9,10 @@ docs/apis/APIKeys0Api.md docs/apis/ApiKeys1Api.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh +src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs +src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs +src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs +src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/docs/APIKEYSApi.md b/samples/client/petstore/csharp/generichost/latest/Tags/docs/APIKEYSApi.md deleted file mode 100644 index 1288211b0932..000000000000 --- a/samples/client/petstore/csharp/generichost/latest/Tags/docs/APIKEYSApi.md +++ /dev/null @@ -1,95 +0,0 @@ -# Org.OpenAPITools.Api.APIKEYSApi - -All URIs are relative to *http://app.files.com/api/rest/v1* - -| Method | HTTP request | Description | -|--------|--------------|-------------| -| [**GetApiKeysId**](APIKEYSApi.md#getapikeysid) | **GET** /api_keys/{id} | Show API Key | - - -# **GetApiKeysId** -> void GetApiKeysId (int id) - -Show API Key - -Show API Key - -### Example -```csharp -using System.Collections.Generic; -using System.Diagnostics; -using Org.OpenAPITools.Api; -using Org.OpenAPITools.Client; -using Org.OpenAPITools.Model; - -namespace Example -{ - public class GetApiKeysIdExample - { - public static void Main() - { - Configuration config = new Configuration(); - config.BasePath = "http://app.files.com/api/rest/v1"; - var apiInstance = new APIKEYSApi(config); - var id = 56; // int | Api Key ID. - - try - { - // Show API Key - apiInstance.GetApiKeysId(id); - } - catch (ApiException e) - { - Debug.Print("Exception when calling APIKEYSApi.GetApiKeysId: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); - } - } - } -} -``` - -#### Using the GetApiKeysIdWithHttpInfo variant -This returns an ApiResponse object which contains the response data, status code and headers. - -```csharp -try -{ - // Show API Key - apiInstance.GetApiKeysIdWithHttpInfo(id); -} -catch (ApiException e) -{ - Debug.Print("Exception when calling APIKEYSApi.GetApiKeysIdWithHttpInfo: " + e.Message); - Debug.Print("Status Code: " + e.ErrorCode); - Debug.Print(e.StackTrace); -} -``` - -### Parameters - -| Name | Type | Description | Notes | -|------|------|-------------|-------| -| **id** | **int** | Api Key ID. | | - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: Not defined - - -### HTTP response details -| Status code | Description | Response headers | -|-------------|-------------|------------------| -| **400** | Bad Request | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java new file mode 100644 index 000000000000..618a21c8a982 --- /dev/null +++ b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java @@ -0,0 +1,51 @@ +/* + * OpenAPI Petstore + * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + * The version of the OpenAPI document: 1.0.0 + * + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package org.openapitools.client.model; + +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Test; + +/** + * Model tests for ArrayOfArrayOfNumberOnly + */ +public class ArrayOfArrayOfNumberOnlyTest { + private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); + + /** + * Model tests for ArrayOfArrayOfNumberOnly + */ + @Test + public void testArrayOfArrayOfNumberOnly() { + // TODO: test ArrayOfArrayOfNumberOnly + } + + /** + * Test the property 'arrayArrayNumber' + */ + @Test + public void arrayArrayNumberTest() { + // TODO: test arrayArrayNumber + } + +} diff --git a/samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java new file mode 100644 index 000000000000..c15567e6ea0b --- /dev/null +++ b/samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java @@ -0,0 +1,38 @@ +package org.openapitools.api.impl; + +import org.openapitools.api.*; +import org.openapitools.model.Client; +import java.util.UUID; + +import java.io.InputStream; +import java.io.OutputStream; +import java.util.List; +import java.util.Map; +import javax.ws.rs.*; +import javax.ws.rs.core.Response; +import org.apache.cxf.jaxrs.model.wadl.Description; +import org.apache.cxf.jaxrs.model.wadl.DocTarget; + +import org.apache.cxf.jaxrs.ext.multipart.*; + + +/** + * OpenAPI Petstore + * + *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ + * + */ +public class AnotherFakeApiServiceImpl implements AnotherFakeApi { + /** + * To test special tags + * + * To test special tags and operation ID starting with number + * + */ + public Client call123testSpecialTags(UUID uuidTest, Client body) { + // TODO: Implement... + + return null; + } + +} From b3a98a617484044ffe8b8f05cf182161d1319150 Mon Sep 17 00:00:00 2001 From: David Gamero Date: Wed, 26 Nov 2025 00:21:40 -0500 Subject: [PATCH 09/10] sync samples --- .../ComposedEnum/.openapi-generator/FILES | 5 -- .../model/ArrayOfArrayOfNumberOnlyTest.java | 51 ------------------- .../builds/default/package-lock.json | 20 -------- .../api/impl/AnotherFakeApiServiceImpl.java | 38 -------------- 4 files changed, 114 deletions(-) delete mode 100644 samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java delete mode 100644 samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java diff --git a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES index b40fe17be173..a0b893ad3a65 100644 --- a/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/ComposedEnum/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -9,11 +8,7 @@ docs/models/MarineAreaCode.md docs/models/StateTerritoryCode.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs -src/Org.OpenAPITools.Test/Model/AreaCodeTests.cs -src/Org.OpenAPITools.Test/Model/MarineAreaCodeTests.cs -src/Org.OpenAPITools.Test/Model/StateTerritoryCodeTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/IApi.cs diff --git a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java b/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java deleted file mode 100644 index 618a21c8a982..000000000000 --- a/samples/client/petstore/java/okhttp-gson/src/test/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnlyTest.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * OpenAPI Petstore - * This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - * The version of the OpenAPI document: 1.0.0 - * - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - - -package org.openapitools.client.model; - -import com.google.gson.TypeAdapter; -import com.google.gson.annotations.JsonAdapter; -import com.google.gson.annotations.SerializedName; -import com.google.gson.stream.JsonReader; -import com.google.gson.stream.JsonWriter; -import java.io.IOException; -import java.math.BigDecimal; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import org.junit.jupiter.api.Disabled; -import org.junit.jupiter.api.Test; - -/** - * Model tests for ArrayOfArrayOfNumberOnly - */ -public class ArrayOfArrayOfNumberOnlyTest { - private final ArrayOfArrayOfNumberOnly model = new ArrayOfArrayOfNumberOnly(); - - /** - * Model tests for ArrayOfArrayOfNumberOnly - */ - @Test - public void testArrayOfArrayOfNumberOnly() { - // TODO: test ArrayOfArrayOfNumberOnly - } - - /** - * Test the property 'arrayArrayNumber' - */ - @Test - public void arrayArrayNumberTest() { - // TODO: test arrayArrayNumber - } - -} diff --git a/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json index 81a74828f47b..bf761534b18d 100644 --- a/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json +++ b/samples/openapi3/client/petstore/typescript/builds/default/package-lock.json @@ -10,7 +10,6 @@ "license": "Unlicense", "dependencies": { "@types/node": "^20.17.10", - "@types/node-fetch": "^2.6.13", "es6-promise": "^4.2.4", "form-data": "^4.0.4", "undici": "^7.16.0" @@ -28,16 +27,6 @@ "undici-types": "~6.21.0" } }, - "node_modules/@types/node-fetch": { - "version": "2.6.13", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz", - "integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==", - "license": "MIT", - "dependencies": { - "@types/node": "*", - "form-data": "^4.0.4" - } - }, "node_modules/asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", @@ -318,15 +307,6 @@ "undici-types": "~6.21.0" } }, - "@types/node-fetch": { - "version": "2.6.13", - "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.6.13.tgz", - "integrity": "sha512-QGpRVpzSaUs30JBSGPjOg4Uveu384erbHBoT1zeONvyCfwQxIkUshLAOqN/k9EjGviPRmWTTe6aH2qySWKTVSw==", - "requires": { - "@types/node": "*", - "form-data": "^4.0.4" - } - }, "asynckit": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", diff --git a/samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java b/samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java deleted file mode 100644 index c15567e6ea0b..000000000000 --- a/samples/server/petstore/jaxrs-cxf/src/main/java/org/openapitools/api/impl/AnotherFakeApiServiceImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -package org.openapitools.api.impl; - -import org.openapitools.api.*; -import org.openapitools.model.Client; -import java.util.UUID; - -import java.io.InputStream; -import java.io.OutputStream; -import java.util.List; -import java.util.Map; -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import org.apache.cxf.jaxrs.model.wadl.Description; -import org.apache.cxf.jaxrs.model.wadl.DocTarget; - -import org.apache.cxf.jaxrs.ext.multipart.*; - - -/** - * OpenAPI Petstore - * - *

This spec is mainly for testing Petstore server and contains fake endpoints, models. Please do not use this for any other purpose. Special characters: \" \\ - * - */ -public class AnotherFakeApiServiceImpl implements AnotherFakeApi { - /** - * To test special tags - * - * To test special tags and operation ID starting with number - * - */ - public Client call123testSpecialTags(UUID uuidTest, Client body) { - // TODO: Implement... - - return null; - } - -} From 4c20bf5c1571989ed303a90c1771b33f1c8d31bc Mon Sep 17 00:00:00 2001 From: David Gamero Date: Wed, 26 Nov 2025 00:23:50 -0500 Subject: [PATCH 10/10] files samples --- .../generichost/latest/HelloWorld/.openapi-generator/FILES | 4 ---- .../latest/InlineEnumAnyOf/.openapi-generator/FILES | 7 ------- .../generichost/latest/OneOfList/.openapi-generator/FILES | 5 ----- .../generichost/latest/Tags/.openapi-generator/FILES | 5 ----- 4 files changed, 21 deletions(-) diff --git a/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES index f5c94a57e68d..479e2c02cc5c 100644 --- a/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/HelloWorld/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -8,10 +7,7 @@ docs/apis/DefaultApi.md docs/models/HelloWorldPostRequest.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs -src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs -src/Org.OpenAPITools.Test/Model/HelloWorldPostRequestTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/DefaultApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES index 2afdf46bf821..8f168c503eca 100644 --- a/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/InlineEnumAnyOf/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -11,13 +10,7 @@ docs/models/IconsSizeParameter.md docs/models/IconsSizeParameterAnyOf.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs -src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs -src/Org.OpenAPITools.Test/Model/FooTests.cs -src/Org.OpenAPITools.Test/Model/IconsDefaultResponseTests.cs -src/Org.OpenAPITools.Test/Model/IconsSizeParameterAnyOfTests.cs -src/Org.OpenAPITools.Test/Model/IconsSizeParameterTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/DefaultApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES index e8ae0e72888c..c3094ea1e371 100644 --- a/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/OneOfList/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -9,11 +8,7 @@ docs/models/OneOfArrayRequest.md docs/models/TestObject.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs -src/Org.OpenAPITools.Test/Api/DefaultApiTests.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs -src/Org.OpenAPITools.Test/Model/OneOfArrayRequestTests.cs -src/Org.OpenAPITools.Test/Model/TestObjectTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md src/Org.OpenAPITools/Api/DefaultApi.cs diff --git a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES index befba8a8e36e..b08037a54926 100644 --- a/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES +++ b/samples/client/petstore/csharp/generichost/latest/Tags/.openapi-generator/FILES @@ -1,5 +1,4 @@ .gitignore -.openapi-generator-ignore Org.OpenAPITools.sln README.md api/openapi.yaml @@ -9,10 +8,6 @@ docs/apis/APIKeys0Api.md docs/apis/ApiKeys1Api.md docs/scripts/git_push.ps1 docs/scripts/git_push.sh -src/Org.OpenAPITools.Test/Api/APIKEYSApiTests.cs -src/Org.OpenAPITools.Test/Api/APIKeys0ApiTests.cs -src/Org.OpenAPITools.Test/Api/ApiKeys1ApiTests.cs -src/Org.OpenAPITools.Test/Api/ApiTestsBase.cs src/Org.OpenAPITools.Test/Api/DependencyInjectionTests.cs src/Org.OpenAPITools.Test/Org.OpenAPITools.Test.csproj src/Org.OpenAPITools.Test/README.md