Skip to content

Commit d6ba0eb

Browse files
committed
fixing http and api request options and making context optional
1 parent b807cc8 commit d6ba0eb

File tree

6 files changed

+17
-15
lines changed

6 files changed

+17
-15
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ test/e2e/generated
1515
samples/generated
1616
samples/swagger-codegen-cli-v2.jar
1717
samples/swagger-codegen-cli-v3.jar
18+
.npmrc

package.json

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,13 @@
11
{
2-
"name": "openapi-typescript-codegen",
3-
"version": "0.29.0",
4-
"description": "Library that generates Typescript clients based on the OpenAPI specification.",
5-
"author": "Ferdi Koomen",
2+
"name": "@paytweed/openapi-typescript-codegen",
3+
"version": "0.0.1",
4+
"description": "Fork of openapi-typescript-codegen for Tweed client generation",
5+
"author": "Tweed",
66
"homepage": "https://github.com/ferdikoomen/openapi-typescript-codegen",
77
"repository": {
88
"type": "git",
99
"url": "git+https://github.com/ferdikoomen/openapi-typescript-codegen.git"
1010
},
11-
"bugs": {
12-
"url": "https://github.com/ferdikoomen/openapi-typescript-codegen/issues"
13-
},
1411
"license": "MIT",
1512
"keywords": [
1613
"openapi",
@@ -27,8 +24,8 @@
2724
],
2825
"maintainers": [
2926
{
30-
"name": "Ferdi Koomen",
31-
"email": "info@madebyferdi.com"
27+
"name": "Tomer Nesimyan",
28+
"email": "tomer@paytweed.com"
3229
}
3330
],
3431
"main": "dist/index.js",
@@ -66,6 +63,9 @@
6663
"fs-extra": "^11.2.0",
6764
"handlebars": "^4.7.8"
6865
},
66+
"publishConfig": {
67+
"@paytweed:registry": "https://npm.pkg.github.com/"
68+
},
6969
"devDependencies": {
7070
"@angular-devkit/build-angular": "18.2.5",
7171
"@angular/animations": "17.3.3",

src/openApi/v2/parser/getOperation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ export const getOperation = (
8080
isDefinition: false,
8181
isNullable: false,
8282
isReadOnly: false,
83-
isRequired: true,
83+
isRequired: false,
8484
link: null,
8585
mediaType: null,
8686
prop: '',

src/openApi/v3/parser/getOperation.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ export const getOperation = (
9292
isDefinition: false,
9393
isNullable: false,
9494
isReadOnly: false,
95-
isRequired: true,
95+
isRequired: false,
9696
link: null,
9797
mediaType: null,
9898
prop: '',

src/templates/core/ApiRequestOptions.hbs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { TweedBaseContext } from '@paytweed/context';
66
export type ApiRequestOptions = {
77
readonly method: 'GET' | 'PUT' | 'POST' | 'DELETE' | 'OPTIONS' | 'HEAD' | 'PATCH';
88
readonly url: string;
9-
readonly context: TweedBaseContext
9+
readonly context?: TweedBaseContext
1010
readonly path?: Record<string, any>;
1111
readonly cookies?: Record<string, any>;
1212
readonly headers?: Record<string, any>;
@@ -17,3 +17,4 @@ export type ApiRequestOptions = {
1717
readonly responseHeader?: string;
1818
readonly errors?: Record<number, string>;
1919
};
20+
"@paytweed/http-client": "1.0.0-experimental.745ee2f",

src/templates/core/HttpRequest.hbs

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { request as __request } from './request';
1313
{{else}}
1414
import type { ApiRequestOptions } from './ApiRequestOptions';
1515
import { BaseHttpRequest } from './BaseHttpRequest';
16-
import type { CancelablePromise } from './CancelablePromise';
16+
import { AxiosResponse } from '@paytweed/http-client';
1717
import type { OpenAPIConfig } from './OpenAPI';
1818
import { request as __request } from './request';
1919
{{/equals}}
@@ -51,10 +51,10 @@ export class {{httpRequest}} extends BaseHttpRequest {
5151
/**
5252
* Request method
5353
* @param options The request options from the service
54-
* @returns CancelablePromise<T>
54+
* @returns AxiosResponse<T>
5555
* @throws ApiError
5656
*/
57-
public override request<T>(options: ApiRequestOptions): CancelablePromise<T> {
57+
public override request<T>(options: ApiRequestOptions): Promise<AxiosResponse<T>> {
5858
return __request(this.config, options);
5959
}
6060
{{/equals}}

0 commit comments

Comments
 (0)