Skip to content

Commit

Permalink
fix(codegen): fix error code parsing when it's a number (#3371)
Browse files Browse the repository at this point in the history
* fix(codegen): fix error code parsing

* fix(codegen): generate all clients
  • Loading branch information
WassimBenzarti authored Jul 13, 2022
1 parent 0dd60ed commit c2d8522
Show file tree
Hide file tree
Showing 281 changed files with 1,124 additions and 281 deletions.
5 changes: 4 additions & 1 deletion clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4047,8 +4047,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-account/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-acm-pca/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3083,8 +3083,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-acm/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2019,8 +2019,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9243,8 +9243,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-amp/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2073,8 +2073,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-amplify/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4366,8 +4366,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-amplifybackend/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4618,8 +4618,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2562,8 +2562,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-api-gateway/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15094,8 +15094,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -376,8 +376,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-apigatewayv2/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9163,8 +9163,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-app-mesh/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7765,8 +7765,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-appconfig/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5279,8 +5279,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-appconfigdata/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-appflow/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5653,8 +5653,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1791,8 +1791,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1620,8 +1620,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3267,8 +3267,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2946,8 +2946,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-apprunner/src/protocols/Aws_json1_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3587,8 +3587,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-appstream/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7516,8 +7516,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-appsync/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5651,8 +5651,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-athena/src/protocols/Aws_json1_1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3965,8 +3965,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-auditmanager/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7130,8 +7130,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1294,8 +1294,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-backup-gateway/src/protocols/Aws_json1_0.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1854,8 +1854,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-backup/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7997,8 +7997,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
5 changes: 4 additions & 1 deletion clients/client-batch/src/protocols/Aws_restJson1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3742,8 +3742,11 @@ const parseBody = (streamBody: any, context: __SerdeContext): any =>
const loadRestJsonErrorCode = (output: __HttpResponse, data: any): string | undefined => {
const findKey = (object: any, key: string) => Object.keys(object).find((k) => k.toLowerCase() === key.toLowerCase());

const sanitizeErrorCode = (rawValue: string): string => {
const sanitizeErrorCode = (rawValue: string | number): string => {
let cleanValue = rawValue;
if (typeof cleanValue === "number") {
cleanValue = cleanValue.toString();
}
if (cleanValue.indexOf(":") >= 0) {
cleanValue = cleanValue.split(":")[0];
}
Expand Down
Loading

0 comments on commit c2d8522

Please sign in to comment.