Skip to content

Release 8.0.1 #224

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# next release

# 8.0.1

Fixes:
- Not working `customFetch`
Error: `Failed to execute 'fetch' on 'Window': Illegal invocation`

# 8.0.0

BREAKING_CHANGES:
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swagger-typescript-api",
"version": "8.0.0",
"version": "8.0.1",
"description": "Generate typescript/javascript api from swagger schema",
"scripts": {
"cli:json": "node index.js -r -d -p ./swagger-test-cli.json -n swagger-test-cli.ts",
Expand Down
4 changes: 2 additions & 2 deletions templates/base/http-clients/fetch-http-client.eta
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -52,7 +52,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: 'same-origin',
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/adafruit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -213,7 +213,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/another-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -189,7 +189,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/another-schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -81,7 +81,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/api-with-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -58,7 +58,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/authentiq.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -110,7 +110,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -123,7 +123,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/example1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -85,7 +85,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/file-formdata-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -58,7 +58,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/furkot-example.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -121,7 +121,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/giphy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -340,7 +340,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/github-swagger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1472,7 +1472,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -1493,7 +1493,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/path-args.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -58,7 +58,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/petstore-expanded.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -95,7 +95,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/petstore-minimal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -66,7 +66,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/petstore-simple.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -81,7 +81,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/petstore-swagger-io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -126,7 +126,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/petstore-with-external-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -71,7 +71,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/petstore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -73,7 +73,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
4 changes: 2 additions & 2 deletions tests/generated/v2.0/query-path-param.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType | null) => Promise<RequestParams | void> | RequestParams | void;
customFetch?: (input: RequestInfo, init?: RequestInit) => Promise<Response>;
customFetch?: typeof fetch;
}

export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
Expand All @@ -58,7 +58,7 @@ export class HttpClient<SecurityDataType = unknown> {
private securityData: SecurityDataType | null = null;
private securityWorker?: ApiConfig<SecurityDataType>["securityWorker"];
private abortControllers = new Map<CancelToken, AbortController>();
private customFetch = fetch;
private customFetch = (...fetchParams: Parameters<typeof fetch>) => fetch(...fetchParams);

private baseApiParams: RequestParams = {
credentials: "same-origin",
Expand Down
Loading