Skip to content

Commit

Permalink
fix: type of style property in requestEncodings (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thiry1 committed Apr 4, 2023
1 parent dfc07a9 commit d709d5f
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 37 deletions.
4 changes: 1 addition & 3 deletions src/code-templates/_shared/ApiClientInterface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,7 @@ const createEncodingInterface = (factory: TsGenerator.Factory.Type) => {
factory.PropertySignature.create({
name: "style",
optional: true,
type: factory.TypeReferenceNode.create({
name: "string",
}),
type: factory.TypeNode.create({ type: "string", enum: ["form", "spaceDelimited", "pipeDelimited", "deepObject"] }),
}),
factory.PropertySignature.create({
name: "explode",
Expand Down
3 changes: 3 additions & 0 deletions src/code-templates/_shared/MethodBody/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@ export const create = (factory: TsGenerator.Factory.Type, params: CodeGenerator.
factory.VariableDeclaration.create({
name: "requestEncodings",
initializer: identifier,
type: factory.TypeReferenceNode.create({
name: "Record<string, Record<string, Encoding>>",
}),
}),
],
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3829,7 +3829,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/class/__snapshots__/format.domain.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export namespace ErrorResponse { }
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/class/__snapshots__/kubernetes-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -41028,7 +41028,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/class/__snapshots__/spit-code-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
6 changes: 3 additions & 3 deletions test/__tests__/class/__snapshots__/template-only-test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -253,7 +253,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -407,7 +407,7 @@ export namespace ErrorResponse { }
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -585,7 +585,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1034,7 +1034,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1211,7 +1211,7 @@ export namespace ErrorResponse { }
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1373,7 +1373,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1441,7 +1441,7 @@ export class Client<RequestOption> {
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json"
};
const requestEncodings = {
const requestEncodings: Record<string, Record<string, Encoding>> = {
"application/x-www-form-urlencoded": {
"color": {
"style": "form",
Expand All @@ -1463,7 +1463,7 @@ export class Client<RequestOption> {
"Content-Type": params.headers["Content-Type"],
Accept: "application/json"
};
const requestEncodings = {
const requestEncodings: Record<string, Record<string, Encoding>> = {
"application/x-www-form-urlencoded": {
"color": {
"style": "form",
Expand Down Expand Up @@ -1599,7 +1599,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3829,7 +3829,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export namespace ErrorResponse { }
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41028,7 +41028,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -256,7 +256,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -413,7 +413,7 @@ export namespace ErrorResponse { }
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -588,7 +588,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1040,7 +1040,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1220,7 +1220,7 @@ export namespace ErrorResponse { }
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1384,7 +1384,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down Expand Up @@ -1452,7 +1452,7 @@ export const createClient = <RequestOption>(apiClient: ApiClient<RequestOption>,
"Content-Type": "application/x-www-form-urlencoded",
Accept: "application/json"
};
const requestEncodings = {
const requestEncodings: Record<string, Record<string, Encoding>> = {
"application/x-www-form-urlencoded": {
"color": {
"style": "form",
Expand All @@ -1474,7 +1474,7 @@ export const createClient = <RequestOption>(apiClient: ApiClient<RequestOption>,
"Content-Type": params.headers["Content-Type"],
Accept: "application/json"
};
const requestEncodings = {
const requestEncodings: Record<string, Record<string, Encoding>> = {
"application/x-www-form-urlencoded": {
"color": {
"style": "form",
Expand Down Expand Up @@ -1613,7 +1613,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export namespace ErrorResponse {
export interface Encoding {
contentType?: string;
headers?: Record<string, any>;
style?: string;
style?: "form" | "spaceDelimited" | "pipeDelimited" | "deepObject";
explode?: boolean;
allowReserved?: boolean;
}
Expand Down

0 comments on commit d709d5f

Please sign in to comment.