Skip to content

Commit d709d5f

Browse files
authored
fix: type of style property in requestEncodings (#110)
1 parent dfc07a9 commit d709d5f

18 files changed

+38
-37
lines changed

src/code-templates/_shared/ApiClientInterface.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,7 @@ const createEncodingInterface = (factory: TsGenerator.Factory.Type) => {
128128
factory.PropertySignature.create({
129129
name: "style",
130130
optional: true,
131-
type: factory.TypeReferenceNode.create({
132-
name: "string",
133-
}),
131+
type: factory.TypeNode.create({ type: "string", enum: ["form", "spaceDelimited", "pipeDelimited", "deepObject"] }),
134132
}),
135133
factory.PropertySignature.create({
136134
name: "explode",

src/code-templates/_shared/MethodBody/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ export const create = (factory: TsGenerator.Factory.Type, params: CodeGenerator.
8282
factory.VariableDeclaration.create({
8383
name: "requestEncodings",
8484
initializer: identifier,
85+
type: factory.TypeReferenceNode.create({
86+
name: "Record<string, Record<string, Encoding>>",
87+
}),
8588
}),
8689
],
8790
}),

test/__tests__/class/__snapshots__/argo-rollout-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3829,7 +3829,7 @@ export namespace ErrorResponse {
38293829
export interface Encoding {
38303830
contentType?: string;
38313831
headers?: Record<string, any>;
3832-
style?: string;
3832+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
38333833
explode?: boolean;
38343834
allowReserved?: boolean;
38353835
}

test/__tests__/class/__snapshots__/format.domain.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export namespace ErrorResponse { }
4646
export interface Encoding {
4747
contentType?: string;
4848
headers?: Record<string, any>;
49-
style?: string;
49+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
5050
explode?: boolean;
5151
allowReserved?: boolean;
5252
}

test/__tests__/class/__snapshots__/kubernetes-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41028,7 +41028,7 @@ export namespace ErrorResponse {
4102841028
export interface Encoding {
4102941029
contentType?: string;
4103041030
headers?: Record<string, any>;
41031-
style?: string;
41031+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
4103241032
explode?: boolean;
4103341033
allowReserved?: boolean;
4103441034
}

test/__tests__/class/__snapshots__/multi-type.test.domain.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export namespace ErrorResponse {
4545
export interface Encoding {
4646
contentType?: string;
4747
headers?: Record<string, any>;
48-
style?: string;
48+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
4949
explode?: boolean;
5050
allowReserved?: boolean;
5151
}

test/__tests__/class/__snapshots__/spit-code-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export namespace ErrorResponse {
126126
export interface Encoding {
127127
contentType?: string;
128128
headers?: Record<string, any>;
129-
style?: string;
129+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
130130
explode?: boolean;
131131
allowReserved?: boolean;
132132
}

test/__tests__/class/__snapshots__/template-only-test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export namespace ErrorResponse {
6363
export interface Encoding {
6464
contentType?: string;
6565
headers?: Record<string, any>;
66-
style?: string;
66+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
6767
explode?: boolean;
6868
allowReserved?: boolean;
6969
}
@@ -253,7 +253,7 @@ export namespace ErrorResponse {
253253
export interface Encoding {
254254
contentType?: string;
255255
headers?: Record<string, any>;
256-
style?: string;
256+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
257257
explode?: boolean;
258258
allowReserved?: boolean;
259259
}
@@ -407,7 +407,7 @@ export namespace ErrorResponse { }
407407
export interface Encoding {
408408
contentType?: string;
409409
headers?: Record<string, any>;
410-
style?: string;
410+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
411411
explode?: boolean;
412412
allowReserved?: boolean;
413413
}

test/__tests__/class/__snapshots__/typedef-with-template-test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export namespace ErrorResponse {
412412
export interface Encoding {
413413
contentType?: string;
414414
headers?: Record<string, any>;
415-
style?: string;
415+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
416416
explode?: boolean;
417417
allowReserved?: boolean;
418418
}
@@ -585,7 +585,7 @@ export namespace ErrorResponse {
585585
export interface Encoding {
586586
contentType?: string;
587587
headers?: Record<string, any>;
588-
style?: string;
588+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
589589
explode?: boolean;
590590
allowReserved?: boolean;
591591
}
@@ -1034,7 +1034,7 @@ export namespace ErrorResponse {
10341034
export interface Encoding {
10351035
contentType?: string;
10361036
headers?: Record<string, any>;
1037-
style?: string;
1037+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
10381038
explode?: boolean;
10391039
allowReserved?: boolean;
10401040
}
@@ -1211,7 +1211,7 @@ export namespace ErrorResponse { }
12111211
export interface Encoding {
12121212
contentType?: string;
12131213
headers?: Record<string, any>;
1214-
style?: string;
1214+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
12151215
explode?: boolean;
12161216
allowReserved?: boolean;
12171217
}
@@ -1373,7 +1373,7 @@ export namespace ErrorResponse {
13731373
export interface Encoding {
13741374
contentType?: string;
13751375
headers?: Record<string, any>;
1376-
style?: string;
1376+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
13771377
explode?: boolean;
13781378
allowReserved?: boolean;
13791379
}
@@ -1441,7 +1441,7 @@ export class Client<RequestOption> {
14411441
"Content-Type": "application/x-www-form-urlencoded",
14421442
Accept: "application/json"
14431443
};
1444-
const requestEncodings = {
1444+
const requestEncodings: Record<string, Record<string, Encoding>> = {
14451445
"application/x-www-form-urlencoded": {
14461446
"color": {
14471447
"style": "form",
@@ -1463,7 +1463,7 @@ export class Client<RequestOption> {
14631463
"Content-Type": params.headers["Content-Type"],
14641464
Accept: "application/json"
14651465
};
1466-
const requestEncodings = {
1466+
const requestEncodings: Record<string, Record<string, Encoding>> = {
14671467
"application/x-www-form-urlencoded": {
14681468
"color": {
14691469
"style": "form",
@@ -1599,7 +1599,7 @@ export namespace ErrorResponse {
15991599
export interface Encoding {
16001600
contentType?: string;
16011601
headers?: Record<string, any>;
1602-
style?: string;
1602+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
16031603
explode?: boolean;
16041604
allowReserved?: boolean;
16051605
}

test/__tests__/class/__snapshots__/unknown-schema-domain-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export namespace ErrorResponse {
4444
export interface Encoding {
4545
contentType?: string;
4646
headers?: Record<string, any>;
47-
style?: string;
47+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
4848
explode?: boolean;
4949
allowReserved?: boolean;
5050
}

test/__tests__/functional/__snapshots__/argo-rollout-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3829,7 +3829,7 @@ export namespace ErrorResponse {
38293829
export interface Encoding {
38303830
contentType?: string;
38313831
headers?: Record<string, any>;
3832-
style?: string;
3832+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
38333833
explode?: boolean;
38343834
allowReserved?: boolean;
38353835
}

test/__tests__/functional/__snapshots__/format.domain.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export namespace ErrorResponse { }
4646
export interface Encoding {
4747
contentType?: string;
4848
headers?: Record<string, any>;
49-
style?: string;
49+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
5050
explode?: boolean;
5151
allowReserved?: boolean;
5252
}

test/__tests__/functional/__snapshots__/kubernetes-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41028,7 +41028,7 @@ export namespace ErrorResponse {
4102841028
export interface Encoding {
4102941029
contentType?: string;
4103041030
headers?: Record<string, any>;
41031-
style?: string;
41031+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
4103241032
explode?: boolean;
4103341033
allowReserved?: boolean;
4103441034
}

test/__tests__/functional/__snapshots__/multi-type.test.domain.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export namespace ErrorResponse {
4545
export interface Encoding {
4646
contentType?: string;
4747
headers?: Record<string, any>;
48-
style?: string;
48+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
4949
explode?: boolean;
5050
allowReserved?: boolean;
5151
}

test/__tests__/functional/__snapshots__/spit-code-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export namespace ErrorResponse {
126126
export interface Encoding {
127127
contentType?: string;
128128
headers?: Record<string, any>;
129-
style?: string;
129+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
130130
explode?: boolean;
131131
allowReserved?: boolean;
132132
}

test/__tests__/functional/__snapshots__/template-only-test.ts.snap

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ export namespace ErrorResponse {
6363
export interface Encoding {
6464
contentType?: string;
6565
headers?: Record<string, any>;
66-
style?: string;
66+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
6767
explode?: boolean;
6868
allowReserved?: boolean;
6969
}
@@ -256,7 +256,7 @@ export namespace ErrorResponse {
256256
export interface Encoding {
257257
contentType?: string;
258258
headers?: Record<string, any>;
259-
style?: string;
259+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
260260
explode?: boolean;
261261
allowReserved?: boolean;
262262
}
@@ -413,7 +413,7 @@ export namespace ErrorResponse { }
413413
export interface Encoding {
414414
contentType?: string;
415415
headers?: Record<string, any>;
416-
style?: string;
416+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
417417
explode?: boolean;
418418
allowReserved?: boolean;
419419
}

test/__tests__/functional/__snapshots__/typedef-with-template-test.ts.snap

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ export namespace ErrorResponse {
412412
export interface Encoding {
413413
contentType?: string;
414414
headers?: Record<string, any>;
415-
style?: string;
415+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
416416
explode?: boolean;
417417
allowReserved?: boolean;
418418
}
@@ -588,7 +588,7 @@ export namespace ErrorResponse {
588588
export interface Encoding {
589589
contentType?: string;
590590
headers?: Record<string, any>;
591-
style?: string;
591+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
592592
explode?: boolean;
593593
allowReserved?: boolean;
594594
}
@@ -1040,7 +1040,7 @@ export namespace ErrorResponse {
10401040
export interface Encoding {
10411041
contentType?: string;
10421042
headers?: Record<string, any>;
1043-
style?: string;
1043+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
10441044
explode?: boolean;
10451045
allowReserved?: boolean;
10461046
}
@@ -1220,7 +1220,7 @@ export namespace ErrorResponse { }
12201220
export interface Encoding {
12211221
contentType?: string;
12221222
headers?: Record<string, any>;
1223-
style?: string;
1223+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
12241224
explode?: boolean;
12251225
allowReserved?: boolean;
12261226
}
@@ -1384,7 +1384,7 @@ export namespace ErrorResponse {
13841384
export interface Encoding {
13851385
contentType?: string;
13861386
headers?: Record<string, any>;
1387-
style?: string;
1387+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
13881388
explode?: boolean;
13891389
allowReserved?: boolean;
13901390
}
@@ -1452,7 +1452,7 @@ export const createClient = <RequestOption>(apiClient: ApiClient<RequestOption>,
14521452
"Content-Type": "application/x-www-form-urlencoded",
14531453
Accept: "application/json"
14541454
};
1455-
const requestEncodings = {
1455+
const requestEncodings: Record<string, Record<string, Encoding>> = {
14561456
"application/x-www-form-urlencoded": {
14571457
"color": {
14581458
"style": "form",
@@ -1474,7 +1474,7 @@ export const createClient = <RequestOption>(apiClient: ApiClient<RequestOption>,
14741474
"Content-Type": params.headers["Content-Type"],
14751475
Accept: "application/json"
14761476
};
1477-
const requestEncodings = {
1477+
const requestEncodings: Record<string, Record<string, Encoding>> = {
14781478
"application/x-www-form-urlencoded": {
14791479
"color": {
14801480
"style": "form",
@@ -1613,7 +1613,7 @@ export namespace ErrorResponse {
16131613
export interface Encoding {
16141614
contentType?: string;
16151615
headers?: Record<string, any>;
1616-
style?: string;
1616+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
16171617
explode?: boolean;
16181618
allowReserved?: boolean;
16191619
}

test/__tests__/functional/__snapshots__/unknown-schema-domain-test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export namespace ErrorResponse {
4444
export interface Encoding {
4545
contentType?: string;
4646
headers?: Record<string, any>;
47-
style?: string;
47+
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
4848
explode?: boolean;
4949
allowReserved?: boolean;
5050
}

0 commit comments

Comments
 (0)