Skip to content
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

fix(codegen): add check for required query parameters #4223

Merged
merged 1 commit into from Nov 23, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
15 changes: 9 additions & 6 deletions clients/client-accessanalyzer/src/protocols/Aws_restJson1.ts
Expand Up @@ -365,7 +365,7 @@ export const serializeAws_restJson1GetAccessPreviewCommand = async (
false
);
const query: any = map({
analyzerArn: [, input.analyzerArn!],
analyzerArn: [, __expectNonNull(input.analyzerArn!, `analyzerArn`)],
});
let body: any;
return new __HttpRequest({
Expand All @@ -388,8 +388,8 @@ export const serializeAws_restJson1GetAnalyzedResourceCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/analyzed-resource";
const query: any = map({
analyzerArn: [, input.analyzerArn!],
resourceArn: [, input.resourceArn!],
analyzerArn: [, __expectNonNull(input.analyzerArn!, `analyzerArn`)],
resourceArn: [, __expectNonNull(input.resourceArn!, `resourceArn`)],
});
let body: any;
return new __HttpRequest({
Expand Down Expand Up @@ -470,7 +470,7 @@ export const serializeAws_restJson1GetFindingCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/finding/{id}";
resolvedPath = __resolvedPath(resolvedPath, input, "id", () => input.id!, "{id}", false);
const query: any = map({
analyzerArn: [, input.analyzerArn!],
analyzerArn: [, __expectNonNull(input.analyzerArn!, `analyzerArn`)],
});
let body: any;
return new __HttpRequest({
Expand Down Expand Up @@ -561,7 +561,7 @@ export const serializeAws_restJson1ListAccessPreviewsCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/access-preview";
const query: any = map({
analyzerArn: [, input.analyzerArn!],
analyzerArn: [, __expectNonNull(input.analyzerArn!, `analyzerArn`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand Down Expand Up @@ -826,7 +826,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
5 changes: 4 additions & 1 deletion clients/client-amp/src/protocols/Aws_restJson1.ts
Expand Up @@ -573,7 +573,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
5 changes: 4 additions & 1 deletion clients/client-amplify/src/protocols/Aws_restJson1.ts
Expand Up @@ -967,7 +967,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
11 changes: 7 additions & 4 deletions clients/client-api-gateway/src/protocols/Aws_restJson1.ts
Expand Up @@ -2393,8 +2393,8 @@ export const serializeAws_restJson1GetUsageCommand = async (
resolvedPath = __resolvedPath(resolvedPath, input, "usagePlanId", () => input.usagePlanId!, "{usagePlanId}", false);
const query: any = map({
keyId: [, input.keyId!],
startDate: [, input.startDate!],
endDate: [, input.endDate!],
startDate: [, __expectNonNull(input.startDate!, `startDate`)],
endDate: [, __expectNonNull(input.endDate!, `endDate`)],
position: [, input.position!],
limit: [() => input.limit !== void 0, () => input.limit!.toString()],
});
Expand Down Expand Up @@ -2561,7 +2561,7 @@ export const serializeAws_restJson1ImportApiKeysCommand = async (
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/apikeys";
const query: any = map({
mode: [, "import"],
format: [, input.format!],
format: [, __expectNonNull(input.format!, `format`)],
failonwarnings: [() => input.failOnWarnings !== void 0, () => input.failOnWarnings!.toString()],
});
let body: any;
Expand Down Expand Up @@ -2993,7 +2993,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
7 changes: 5 additions & 2 deletions clients/client-apigatewayv2/src/protocols/Aws_restJson1.ts
Expand Up @@ -1041,7 +1041,7 @@ export const serializeAws_restJson1ExportApiCommand = async (
const query: any = map({
exportVersion: [, input.ExportVersion!],
includeExtensions: [() => input.IncludeExtensions !== void 0, () => input.IncludeExtensions!.toString()],
outputType: [, input.OutputType!],
outputType: [, __expectNonNull(input.OutputType!, `OutputType`)],
stageName: [, input.StageName!],
});
let body: any;
Expand Down Expand Up @@ -1846,7 +1846,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v2/tags/{ResourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ResourceArn", () => input.ResourceArn!, "{ResourceArn}", false);
const query: any = map({
tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.TagKeys, `TagKeys`) != null,
() => (input.TagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
6 changes: 3 additions & 3 deletions clients/client-app-mesh/src/protocols/Aws_restJson1.ts
Expand Up @@ -1092,7 +1092,7 @@ export const serializeAws_restJson1ListTagsForResourceCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/tags";
const query: any = map({
resourceArn: [, input.resourceArn!],
resourceArn: [, __expectNonNull(input.resourceArn!, `resourceArn`)],
nextToken: [, input.nextToken!],
limit: [() => input.limit !== void 0, () => input.limit!.toString()],
});
Expand Down Expand Up @@ -1230,7 +1230,7 @@ export const serializeAws_restJson1TagResourceCommand = async (
};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/tag";
const query: any = map({
resourceArn: [, input.resourceArn!],
resourceArn: [, __expectNonNull(input.resourceArn!, `resourceArn`)],
});
let body: any;
body = JSON.stringify({
Expand Down Expand Up @@ -1258,7 +1258,7 @@ export const serializeAws_restJson1UntagResourceCommand = async (
};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v20190125/untag";
const query: any = map({
resourceArn: [, input.resourceArn!],
resourceArn: [, __expectNonNull(input.resourceArn!, `resourceArn`)],
});
let body: any;
body = JSON.stringify({
Expand Down
9 changes: 6 additions & 3 deletions clients/client-appconfig/src/protocols/Aws_restJson1.ts
Expand Up @@ -686,7 +686,7 @@ export const serializeAws_restJson1GetConfigurationCommand = async (
false
);
const query: any = map({
client_id: [, input.ClientId!],
client_id: [, __expectNonNull(input.ClientId!, `ClientId`)],
client_configuration_version: [, input.ClientConfigurationVersion!],
});
let body: any;
Expand Down Expand Up @@ -1357,7 +1357,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{ResourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "ResourceArn", () => input.ResourceArn!, "{ResourceArn}", false);
const query: any = map({
tagKeys: [() => input.TagKeys !== void 0, () => (input.TagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.TagKeys, `TagKeys`) != null,
() => (input.TagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down Expand Up @@ -1631,7 +1634,7 @@ export const serializeAws_restJson1ValidateConfigurationCommand = async (
false
);
const query: any = map({
configuration_version: [, input.ConfigurationVersion!],
configuration_version: [, __expectNonNull(input.ConfigurationVersion!, `ConfigurationVersion`)],
});
let body: any;
return new __HttpRequest({
Expand Down
Expand Up @@ -43,7 +43,7 @@ export const serializeAws_restJson1GetLatestConfigurationCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/configuration";
const query: any = map({
configuration_token: [, input.ConfigurationToken!],
configuration_token: [, __expectNonNull(input.ConfigurationToken!, `ConfigurationToken`)],
});
let body: any;
return new __HttpRequest({
Expand Down
5 changes: 4 additions & 1 deletion clients/client-appflow/src/protocols/Aws_restJson1.ts
Expand Up @@ -768,7 +768,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
Expand Up @@ -408,7 +408,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
11 changes: 7 additions & 4 deletions clients/client-appsync/src/protocols/Aws_restJson1.ts
Expand Up @@ -854,7 +854,7 @@ export const serializeAws_restJson1GetIntrospectionSchemaCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/schema";
resolvedPath = __resolvedPath(resolvedPath, input, "apiId", () => input.apiId!, "{apiId}", false);
const query: any = map({
format: [, input.format!],
format: [, __expectNonNull(input.format!, `format`)],
includeDirectives: [() => input.includeDirectives !== void 0, () => input.includeDirectives!.toString()],
});
let body: any;
Expand Down Expand Up @@ -926,7 +926,7 @@ export const serializeAws_restJson1GetTypeCommand = async (
resolvedPath = __resolvedPath(resolvedPath, input, "apiId", () => input.apiId!, "{apiId}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "typeName", () => input.typeName!, "{typeName}", false);
const query: any = map({
format: [, input.format!],
format: [, __expectNonNull(input.format!, `format`)],
});
let body: any;
return new __HttpRequest({
Expand Down Expand Up @@ -1151,7 +1151,7 @@ export const serializeAws_restJson1ListTypesCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/apis/{apiId}/types";
resolvedPath = __resolvedPath(resolvedPath, input, "apiId", () => input.apiId!, "{apiId}", false);
const query: any = map({
format: [, input.format!],
format: [, __expectNonNull(input.format!, `format`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand Down Expand Up @@ -1228,7 +1228,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/v1/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
23 changes: 13 additions & 10 deletions clients/client-auditmanager/src/protocols/Aws_restJson1.ts
Expand Up @@ -664,7 +664,7 @@ export const serializeAws_restJson1DeleteAssessmentFrameworkShareCommand = async
"/assessmentFrameworkShareRequests/{requestId}";
resolvedPath = __resolvedPath(resolvedPath, input, "requestId", () => input.requestId!, "{requestId}", false);
const query: any = map({
requestType: [, input.requestType!],
requestType: [, __expectNonNull(input.requestType!, `requestType`)],
});
let body: any;
return new __HttpRequest({
Expand Down Expand Up @@ -1348,8 +1348,8 @@ export const serializeAws_restJson1ListAssessmentControlInsightsByControlDomainC
const resolvedPath =
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/controls-by-assessment";
const query: any = map({
controlDomainId: [, input.controlDomainId!],
assessmentId: [, input.assessmentId!],
controlDomainId: [, __expectNonNull(input.controlDomainId!, `controlDomainId`)],
assessmentId: [, __expectNonNull(input.assessmentId!, `assessmentId`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand All @@ -1374,7 +1374,7 @@ export const serializeAws_restJson1ListAssessmentFrameworksCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworks";
const query: any = map({
frameworkType: [, input.frameworkType!],
frameworkType: [, __expectNonNull(input.frameworkType!, `frameworkType`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand All @@ -1400,7 +1400,7 @@ export const serializeAws_restJson1ListAssessmentFrameworkShareRequestsCommand =
const resolvedPath =
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/assessmentFrameworkShareRequests";
const query: any = map({
requestType: [, input.requestType!],
requestType: [, __expectNonNull(input.requestType!, `requestType`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand Down Expand Up @@ -1500,7 +1500,7 @@ export const serializeAws_restJson1ListControlDomainInsightsByAssessmentCommand
const resolvedPath =
`${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/control-domains-by-assessment";
const query: any = map({
assessmentId: [, input.assessmentId!],
assessmentId: [, __expectNonNull(input.assessmentId!, `assessmentId`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand All @@ -1525,7 +1525,7 @@ export const serializeAws_restJson1ListControlInsightsByControlDomainCommand = a
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/insights/controls";
const query: any = map({
controlDomainId: [, input.controlDomainId!],
controlDomainId: [, __expectNonNull(input.controlDomainId!, `controlDomainId`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand All @@ -1550,7 +1550,7 @@ export const serializeAws_restJson1ListControlsCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/controls";
const query: any = map({
controlType: [, input.controlType!],
controlType: [, __expectNonNull(input.controlType!, `controlType`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand All @@ -1575,7 +1575,7 @@ export const serializeAws_restJson1ListKeywordsForDataSourceCommand = async (
const headers: any = {};
const resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/dataSourceKeywords";
const query: any = map({
source: [, input.source!],
source: [, __expectNonNull(input.source!, `source`)],
nextToken: [, input.nextToken!],
maxResults: [() => input.maxResults !== void 0, () => input.maxResults!.toString()],
});
Expand Down Expand Up @@ -1750,7 +1750,10 @@ export const serializeAws_restJson1UntagResourceCommand = async (
let resolvedPath = `${basePath?.endsWith("/") ? basePath.slice(0, -1) : basePath || ""}` + "/tags/{resourceArn}";
resolvedPath = __resolvedPath(resolvedPath, input, "resourceArn", () => input.resourceArn!, "{resourceArn}", false);
const query: any = map({
tagKeys: [() => input.tagKeys !== void 0, () => (input.tagKeys! || []).map((_entry) => _entry as any)],
tagKeys: [
__expectNonNull(input.tagKeys, `tagKeys`) != null,
() => (input.tagKeys! || []).map((_entry) => _entry as any),
],
});
let body: any;
return new __HttpRequest({
Expand Down
10 changes: 5 additions & 5 deletions clients/client-backupstorage/src/protocols/Aws_restJson1.ts
Expand Up @@ -223,8 +223,8 @@ export const serializeAws_restJson1NotifyObjectCompleteCommand = async (
resolvedPath = __resolvedPath(resolvedPath, input, "BackupJobId", () => input.BackupJobId!, "{BackupJobId}", false);
resolvedPath = __resolvedPath(resolvedPath, input, "UploadId", () => input.UploadId!, "{UploadId}", false);
const query: any = map({
checksum: [, input.ObjectChecksum!],
"checksum-algorithm": [, input.ObjectChecksumAlgorithm!],
checksum: [, __expectNonNull(input.ObjectChecksum!, `ObjectChecksum`)],
"checksum-algorithm": [, __expectNonNull(input.ObjectChecksumAlgorithm!, `ObjectChecksumAlgorithm`)],
"metadata-string": [, input.MetadataString!],
"metadata-blob-length": [() => input.MetadataBlobLength !== void 0, () => input.MetadataBlobLength!.toString()],
"metadata-checksum": [, input.MetadataBlobChecksum!],
Expand Down Expand Up @@ -269,9 +269,9 @@ export const serializeAws_restJson1PutChunkCommand = async (
false
);
const query: any = map({
length: [() => input.Length !== void 0, () => input.Length!.toString()],
checksum: [, input.Checksum!],
"checksum-algorithm": [, input.ChecksumAlgorithm!],
length: [__expectNonNull(input.Length, `Length`) != null, () => input.Length!.toString()],
checksum: [, __expectNonNull(input.Checksum!, `Checksum`)],
"checksum-algorithm": [, __expectNonNull(input.ChecksumAlgorithm!, `ChecksumAlgorithm`)],
});
let body: any;
if (input.Data !== undefined) {
Expand Down