From c91daa3d10e411f1e3a1751c5e8cab6b50bbe104 Mon Sep 17 00:00:00 2001 From: Paul Visscher Date: Tue, 29 Nov 2022 00:15:20 +0100 Subject: [PATCH] feat: add apigateway schemas --- src/lib/aws/apigateway/apigateway.schema.ts | 98 ++++++++++++++ src/lib/aws/apigateway/apigateway.type.ts | 120 ++++++++++++++++++ src/lib/aws/apigateway/index.ts | 1 + .../schemas/api-gateway-proxy-event.schema.js | 5 + 4 files changed, 224 insertions(+) create mode 100644 src/lib/aws/apigateway/apigateway.schema.ts create mode 100644 src/lib/aws/apigateway/apigateway.type.ts create mode 100644 src/lib/aws/apigateway/index.ts create mode 100644 src/lib/aws/apigateway/schemas/api-gateway-proxy-event.schema.js diff --git a/src/lib/aws/apigateway/apigateway.schema.ts b/src/lib/aws/apigateway/apigateway.schema.ts new file mode 100644 index 0000000..ddeea0d --- /dev/null +++ b/src/lib/aws/apigateway/apigateway.schema.ts @@ -0,0 +1,98 @@ +import { + $array, + $boolean, + $const, + $dict, + $integer, + $null, + $object, + $optional, + $ref, + $string, + $union, + $unknown, + $validator, +} from '@skyleague/therefore' +import type { ThereforeSchema } from '@skyleague/therefore/src/lib/primitives/types' + +export const APIGatewayProxyEventHeaders = $dict($string) +export const APIGatewayProxyEventMultiValueHeaders = $dict($array($string)) +export const APIGatewayProxyEventPathParameters = $dict($string) +export const APIGatewayProxyEventQueryStringParameters = $dict($string) +export const APIGatewayProxyEventMultiValueQueryStringParameters = $dict($array($string)) +export const APIGatewayProxyEventStageVariables = $dict($string) + +export const APIGatewayEventDefaultAuthorizerContext = $union([$const(undefined), $null, $dict($unknown)]) + +export const APIGatewayEventClientCertificate = $object({ + clientCertPem: $string, + serialNumber: $string, + subjectDN: $string, + issuerDN: $string, + validity: $object({ + notAfter: $string, + notBefore: $string, + }), +}) + +export const APIGatewayEventIdentity = $object({ + accessKey: $union([$string, $null]), + accountId: $union([$string, $null]), + apiKey: $union([$string, $null]), + apiKeyId: $union([$string, $null]), + caller: $union([$string, $null]), + clientCert: $union([$ref(APIGatewayEventClientCertificate), $null]), + cognitoAuthenticationProvider: $union([$string, $null]), + cognitoAuthenticationType: $union([$string, $null]), + cognitoIdentityId: $union([$string, $null]), + cognitoIdentityPoolId: $union([$string, $null]), + principalOrgId: $union([$string, $null]), + sourceIp: $string, + user: $union([$string, $null]), + userAgent: $union([$string, $null]), + userArn: $union([$string, $null]), +}) + +export const APIGatewayEventRequestContextWithAuthorizer = (context: ThereforeSchema) => + $object({ + accountId: $string, + apiId: $string, + authorizer: context, + connectedAt: $optional($integer, 'explicit'), + connectionId: $optional($string, 'explicit'), + domainName: $optional($string, 'explicit'), + domainPrefix: $optional($string, 'explicit'), + eventType: $optional($string, 'explicit'), + extendedRequestId: $optional($string, 'explicit'), + protocol: $string, + httpMethod: $string, + identity: $ref(APIGatewayEventIdentity), + messageDirection: $optional($string, 'explicit'), + messageId: $union([$string, $null, $const(undefined)]), + path: $string, + stage: $string, + requestId: $string, + requestTime: $optional($string, 'explicit'), + requestTimeEpoch: $integer, + resourceId: $string, + resourcePath: $string, + routeKey: $optional($string, 'explicit'), + }) + +export const APIGatewayProxyEventBase = (context: ThereforeSchema) => + $object({ + body: $union([$string, $null]), + headers: $ref(APIGatewayProxyEventHeaders), + multiValueHeaders: $ref(APIGatewayProxyEventMultiValueHeaders), + httpMethod: $string, + isBase64Encoded: $boolean, + path: $string, + pathParameters: $union([$ref(APIGatewayProxyEventPathParameters), $null]), + queryStringParameters: $union([$ref(APIGatewayProxyEventQueryStringParameters), $null]), + multiValueQueryStringParameters: $union([$ref(APIGatewayProxyEventMultiValueQueryStringParameters), $null]), + stageVariables: $union([$ref(APIGatewayProxyEventStageVariables), $null]), + requestContext: APIGatewayEventRequestContextWithAuthorizer(context), + resource: $string, + }) + +export const APIGatewayProxyEvent = $validator(APIGatewayProxyEventBase(APIGatewayEventDefaultAuthorizerContext)) diff --git a/src/lib/aws/apigateway/apigateway.type.ts b/src/lib/aws/apigateway/apigateway.type.ts new file mode 100644 index 0000000..f6d7133 --- /dev/null +++ b/src/lib/aws/apigateway/apigateway.type.ts @@ -0,0 +1,120 @@ +/** + * Generated by @skyleague/therefore@v1.0.0-local + * Do not manually touch this + */ +/* eslint-disable */ +import AjvValidator from 'ajv' +import type { ValidateFunction } from 'ajv' + +export interface APIGatewayProxyEventHeaders { + [k: string]: string | undefined +} + +export interface APIGatewayProxyEventMultiValueHeaders { + [k: string]: string[] | undefined +} + +export interface APIGatewayProxyEventPathParameters { + [k: string]: string | undefined +} + +export interface APIGatewayProxyEventQueryStringParameters { + [k: string]: string | undefined +} + +export interface APIGatewayProxyEventMultiValueQueryStringParameters { + [k: string]: string[] | undefined +} + +export interface APIGatewayProxyEventStageVariables { + [k: string]: string | undefined +} + +export type APIGatewayEventDefaultAuthorizerContext = null | null | { + [k: string]: unknown | undefined +} + +export interface APIGatewayEventClientCertificate { + clientCertPem: string + serialNumber: string + subjectDN: string + issuerDN: string + validity: { + notAfter: string + notBefore: string + } +} + +export interface APIGatewayEventIdentity { + accessKey: string | null + accountId: string | null + apiKey: string | null + apiKeyId: string | null + caller: string | null + clientCert: APIGatewayEventClientCertificate | null + cognitoAuthenticationProvider: string | null + cognitoAuthenticationType: string | null + cognitoIdentityId: string | null + cognitoIdentityPoolId: string | null + principalOrgId: string | null + sourceIp: string + user: string | null + userAgent: string | null + userArn: string | null +} + +export interface APIGatewayProxyEvent { + body: string | null + headers: APIGatewayProxyEventHeaders + multiValueHeaders: APIGatewayProxyEventMultiValueHeaders + httpMethod: string + isBase64Encoded: boolean + path: string + pathParameters: APIGatewayProxyEventPathParameters | null + queryStringParameters: APIGatewayProxyEventQueryStringParameters | null + multiValueQueryStringParameters: APIGatewayProxyEventMultiValueQueryStringParameters | null + stageVariables: APIGatewayProxyEventStageVariables | null + requestContext: { + accountId: string + apiId: string + authorizer: null | null | { + [k: string]: unknown | undefined + } + connectedAt?: number | undefined + connectionId?: string | undefined + domainName?: string | undefined + domainPrefix?: string | undefined + eventType?: string | undefined + extendedRequestId?: string | undefined + protocol: string + httpMethod: string + identity: APIGatewayEventIdentity + messageDirection?: string | undefined + messageId: string | null | null + path: string + stage: string + requestId: string + requestTime?: string | undefined + requestTimeEpoch: number + resourceId: string + resourcePath: string + routeKey?: string | undefined + } + resource: string +} + +export const APIGatewayProxyEvent = { + validate: require('./schemas/api-gateway-proxy-event.schema.js') as ValidateFunction, + get schema() { + return APIGatewayProxyEvent.validate.schema + }, + get errors() { + return APIGatewayProxyEvent.validate.errors ?? undefined + }, + is: (o: unknown): o is APIGatewayProxyEvent => APIGatewayProxyEvent.validate(o) === true, + assert: (o: unknown) => { + if (!APIGatewayProxyEvent.validate(o)) { + throw new AjvValidator.ValidationError(APIGatewayProxyEvent.errors ?? []) + } + }, +} as const diff --git a/src/lib/aws/apigateway/index.ts b/src/lib/aws/apigateway/index.ts new file mode 100644 index 0000000..76ad401 --- /dev/null +++ b/src/lib/aws/apigateway/index.ts @@ -0,0 +1 @@ +export * from './apigateway.type' diff --git a/src/lib/aws/apigateway/schemas/api-gateway-proxy-event.schema.js b/src/lib/aws/apigateway/schemas/api-gateway-proxy-event.schema.js new file mode 100644 index 0000000..076ecda --- /dev/null +++ b/src/lib/aws/apigateway/schemas/api-gateway-proxy-event.schema.js @@ -0,0 +1,5 @@ +/** + * Generated by @skyleague/therefore + * eslint-disable + */ +"use strict";module.exports = validate10;module.exports.default = validate10;const schema11 = {"$schema":"http://json-schema.org/draft-07/schema#","title":"APIGatewayProxyEvent","type":"object","properties":{"body":{"anyOf":[{"type":"string"},{"type":"null"}]},"headers":{"$ref":"#/$defs/APIGatewayProxyEventHeaders"},"multiValueHeaders":{"$ref":"#/$defs/APIGatewayProxyEventMultiValueHeaders"},"httpMethod":{"type":"string"},"isBase64Encoded":{"type":"boolean"},"path":{"type":"string"},"pathParameters":{"anyOf":[{"$ref":"#/$defs/APIGatewayProxyEventPathParameters"},{"type":"null"}]},"queryStringParameters":{"anyOf":[{"$ref":"#/$defs/APIGatewayProxyEventQueryStringParameters"},{"type":"null"}]},"multiValueQueryStringParameters":{"anyOf":[{"$ref":"#/$defs/APIGatewayProxyEventMultiValueQueryStringParameters"},{"type":"null"}]},"stageVariables":{"anyOf":[{"$ref":"#/$defs/APIGatewayProxyEventStageVariables"},{"type":"null"}]},"requestContext":{"type":"object","properties":{"accountId":{"type":"string"},"apiId":{"type":"string"},"authorizer":{"anyOf":[{},{"type":"null"},{"type":"object","additionalProperties":{}}]},"connectedAt":{"type":"integer"},"connectionId":{"type":"string"},"domainName":{"type":"string"},"domainPrefix":{"type":"string"},"eventType":{"type":"string"},"extendedRequestId":{"type":"string"},"protocol":{"type":"string"},"httpMethod":{"type":"string"},"identity":{"$ref":"#/$defs/APIGatewayEventIdentity"},"messageDirection":{"type":"string"},"messageId":{"anyOf":[{"type":"string"},{"type":"null"},{}]},"path":{"type":"string"},"stage":{"type":"string"},"requestId":{"type":"string"},"requestTime":{"type":"string"},"requestTimeEpoch":{"type":"integer"},"resourceId":{"type":"string"},"resourcePath":{"type":"string"},"routeKey":{"type":"string"}},"required":["accountId","apiId","authorizer","protocol","httpMethod","identity","messageId","path","stage","requestId","requestTimeEpoch","resourceId","resourcePath"],"additionalProperties":true},"resource":{"type":"string"}},"required":["body","headers","multiValueHeaders","httpMethod","isBase64Encoded","path","pathParameters","queryStringParameters","multiValueQueryStringParameters","stageVariables","requestContext","resource"],"additionalProperties":true,"$defs":{"APIGatewayProxyEventHeaders":{"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventHeaders"},"APIGatewayProxyEventMultiValueHeaders":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"APIGatewayProxyEventMultiValueHeaders"},"APIGatewayProxyEventPathParameters":{"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventPathParameters"},"APIGatewayProxyEventQueryStringParameters":{"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventQueryStringParameters"},"APIGatewayProxyEventMultiValueQueryStringParameters":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"APIGatewayProxyEventMultiValueQueryStringParameters"},"APIGatewayProxyEventStageVariables":{"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventStageVariables"},"APIGatewayEventIdentity":{"type":"object","properties":{"accessKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiKeyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"caller":{"anyOf":[{"type":"string"},{"type":"null"}]},"clientCert":{"anyOf":[{"$ref":"#/$defs/APIGatewayEventClientCertificate"},{"type":"null"}]},"cognitoAuthenticationProvider":{"anyOf":[{"type":"string"},{"type":"null"}]},"cognitoAuthenticationType":{"anyOf":[{"type":"string"},{"type":"null"}]},"cognitoIdentityId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cognitoIdentityPoolId":{"anyOf":[{"type":"string"},{"type":"null"}]},"principalOrgId":{"anyOf":[{"type":"string"},{"type":"null"}]},"sourceIp":{"type":"string"},"user":{"anyOf":[{"type":"string"},{"type":"null"}]},"userAgent":{"anyOf":[{"type":"string"},{"type":"null"}]},"userArn":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["accessKey","accountId","apiKey","apiKeyId","caller","clientCert","cognitoAuthenticationProvider","cognitoAuthenticationType","cognitoIdentityId","cognitoIdentityPoolId","principalOrgId","sourceIp","user","userAgent","userArn"],"additionalProperties":true,"title":"APIGatewayEventIdentity"},"APIGatewayEventClientCertificate":{"type":"object","properties":{"clientCertPem":{"type":"string"},"serialNumber":{"type":"string"},"subjectDN":{"type":"string"},"issuerDN":{"type":"string"},"validity":{"type":"object","properties":{"notAfter":{"type":"string"},"notBefore":{"type":"string"}},"required":["notAfter","notBefore"],"additionalProperties":true}},"required":["clientCertPem","serialNumber","subjectDN","issuerDN","validity"],"additionalProperties":true,"title":"APIGatewayEventClientCertificate"}}};const schema12 = {"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventHeaders"};const schema13 = {"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"APIGatewayProxyEventMultiValueHeaders"};const schema14 = {"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventPathParameters"};const schema15 = {"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventQueryStringParameters"};const schema16 = {"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}},"title":"APIGatewayProxyEventMultiValueQueryStringParameters"};const schema17 = {"type":"object","additionalProperties":{"type":"string"},"title":"APIGatewayProxyEventStageVariables"};const schema18 = {"type":"object","properties":{"accessKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"accountId":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiKey":{"anyOf":[{"type":"string"},{"type":"null"}]},"apiKeyId":{"anyOf":[{"type":"string"},{"type":"null"}]},"caller":{"anyOf":[{"type":"string"},{"type":"null"}]},"clientCert":{"anyOf":[{"$ref":"#/$defs/APIGatewayEventClientCertificate"},{"type":"null"}]},"cognitoAuthenticationProvider":{"anyOf":[{"type":"string"},{"type":"null"}]},"cognitoAuthenticationType":{"anyOf":[{"type":"string"},{"type":"null"}]},"cognitoIdentityId":{"anyOf":[{"type":"string"},{"type":"null"}]},"cognitoIdentityPoolId":{"anyOf":[{"type":"string"},{"type":"null"}]},"principalOrgId":{"anyOf":[{"type":"string"},{"type":"null"}]},"sourceIp":{"type":"string"},"user":{"anyOf":[{"type":"string"},{"type":"null"}]},"userAgent":{"anyOf":[{"type":"string"},{"type":"null"}]},"userArn":{"anyOf":[{"type":"string"},{"type":"null"}]}},"required":["accessKey","accountId","apiKey","apiKeyId","caller","clientCert","cognitoAuthenticationProvider","cognitoAuthenticationType","cognitoIdentityId","cognitoIdentityPoolId","principalOrgId","sourceIp","user","userAgent","userArn"],"additionalProperties":true,"title":"APIGatewayEventIdentity"};const schema19 = {"type":"object","properties":{"clientCertPem":{"type":"string"},"serialNumber":{"type":"string"},"subjectDN":{"type":"string"},"issuerDN":{"type":"string"},"validity":{"type":"object","properties":{"notAfter":{"type":"string"},"notBefore":{"type":"string"}},"required":["notAfter","notBefore"],"additionalProperties":true}},"required":["clientCertPem","serialNumber","subjectDN","issuerDN","validity"],"additionalProperties":true,"title":"APIGatewayEventClientCertificate"};function validate11(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;let valid0 = true;for( missing0 of schema18.required){valid0 = data[missing0] !== undefined;if(!valid0){validate11.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;break;}}if(valid0){if(data.accessKey !== undefined){let data0 = data.accessKey;const _errs2 = errors;const _errs3 = errors;let valid2 = false;const _errs4 = errors;if(typeof data0 !== "string"){const err0 = {instancePath:instancePath+"/accessKey",schemaPath:"#/properties/accessKey/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}var _valid0 = _errs4 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs6 = errors;if(data0 !== null){const err1 = {instancePath:instancePath+"/accessKey",schemaPath:"#/properties/accessKey/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}var _valid0 = _errs6 === errors;valid2 = valid2 || _valid0;}if(!valid2){const err2 = {instancePath:instancePath+"/accessKey",schemaPath:"#/properties/accessKey/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs3;if(vErrors !== null){if(_errs3){vErrors.length = _errs3;}else {vErrors = null;}}}var valid1 = _errs2 === errors;}else {var valid1 = true;}if(valid1){if(data.accountId !== undefined){let data1 = data.accountId;const _errs8 = errors;const _errs9 = errors;let valid3 = false;const _errs10 = errors;if(typeof data1 !== "string"){const err3 = {instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err3];}else {vErrors.push(err3);}errors++;}var _valid1 = _errs10 === errors;valid3 = valid3 || _valid1;if(!valid3){const _errs12 = errors;if(data1 !== null){const err4 = {instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err4];}else {vErrors.push(err4);}errors++;}var _valid1 = _errs12 === errors;valid3 = valid3 || _valid1;}if(!valid3){const err5 = {instancePath:instancePath+"/accountId",schemaPath:"#/properties/accountId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err5];}else {vErrors.push(err5);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs9;if(vErrors !== null){if(_errs9){vErrors.length = _errs9;}else {vErrors = null;}}}var valid1 = _errs8 === errors;}else {var valid1 = true;}if(valid1){if(data.apiKey !== undefined){let data2 = data.apiKey;const _errs14 = errors;const _errs15 = errors;let valid4 = false;const _errs16 = errors;if(typeof data2 !== "string"){const err6 = {instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err6];}else {vErrors.push(err6);}errors++;}var _valid2 = _errs16 === errors;valid4 = valid4 || _valid2;if(!valid4){const _errs18 = errors;if(data2 !== null){const err7 = {instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err7];}else {vErrors.push(err7);}errors++;}var _valid2 = _errs18 === errors;valid4 = valid4 || _valid2;}if(!valid4){const err8 = {instancePath:instancePath+"/apiKey",schemaPath:"#/properties/apiKey/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err8];}else {vErrors.push(err8);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs15;if(vErrors !== null){if(_errs15){vErrors.length = _errs15;}else {vErrors = null;}}}var valid1 = _errs14 === errors;}else {var valid1 = true;}if(valid1){if(data.apiKeyId !== undefined){let data3 = data.apiKeyId;const _errs20 = errors;const _errs21 = errors;let valid5 = false;const _errs22 = errors;if(typeof data3 !== "string"){const err9 = {instancePath:instancePath+"/apiKeyId",schemaPath:"#/properties/apiKeyId/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err9];}else {vErrors.push(err9);}errors++;}var _valid3 = _errs22 === errors;valid5 = valid5 || _valid3;if(!valid5){const _errs24 = errors;if(data3 !== null){const err10 = {instancePath:instancePath+"/apiKeyId",schemaPath:"#/properties/apiKeyId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err10];}else {vErrors.push(err10);}errors++;}var _valid3 = _errs24 === errors;valid5 = valid5 || _valid3;}if(!valid5){const err11 = {instancePath:instancePath+"/apiKeyId",schemaPath:"#/properties/apiKeyId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err11];}else {vErrors.push(err11);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs21;if(vErrors !== null){if(_errs21){vErrors.length = _errs21;}else {vErrors = null;}}}var valid1 = _errs20 === errors;}else {var valid1 = true;}if(valid1){if(data.caller !== undefined){let data4 = data.caller;const _errs26 = errors;const _errs27 = errors;let valid6 = false;const _errs28 = errors;if(typeof data4 !== "string"){const err12 = {instancePath:instancePath+"/caller",schemaPath:"#/properties/caller/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err12];}else {vErrors.push(err12);}errors++;}var _valid4 = _errs28 === errors;valid6 = valid6 || _valid4;if(!valid6){const _errs30 = errors;if(data4 !== null){const err13 = {instancePath:instancePath+"/caller",schemaPath:"#/properties/caller/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err13];}else {vErrors.push(err13);}errors++;}var _valid4 = _errs30 === errors;valid6 = valid6 || _valid4;}if(!valid6){const err14 = {instancePath:instancePath+"/caller",schemaPath:"#/properties/caller/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err14];}else {vErrors.push(err14);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs27;if(vErrors !== null){if(_errs27){vErrors.length = _errs27;}else {vErrors = null;}}}var valid1 = _errs26 === errors;}else {var valid1 = true;}if(valid1){if(data.clientCert !== undefined){let data5 = data.clientCert;const _errs32 = errors;const _errs33 = errors;let valid7 = false;const _errs34 = errors;const _errs35 = errors;if(errors === _errs35){if(data5 && typeof data5 == "object" && !Array.isArray(data5)){let missing1;let valid9 = true;for( missing1 of schema19.required){valid9 = data5[missing1] !== undefined;if(!valid9){const err15 = {instancePath:instancePath+"/clientCert",schemaPath:"#/$defs/APIGatewayEventClientCertificate/required",keyword:"required",params:{missingProperty: missing1},message:"must have required property '"+missing1+"'"};if(vErrors === null){vErrors = [err15];}else {vErrors.push(err15);}errors++;break;}}if(valid9){if(data5.clientCertPem !== undefined){const _errs38 = errors;if(typeof data5.clientCertPem !== "string"){const err16 = {instancePath:instancePath+"/clientCert/clientCertPem",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/clientCertPem/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err16];}else {vErrors.push(err16);}errors++;}var valid10 = _errs38 === errors;}else {var valid10 = true;}if(valid10){if(data5.serialNumber !== undefined){const _errs40 = errors;if(typeof data5.serialNumber !== "string"){const err17 = {instancePath:instancePath+"/clientCert/serialNumber",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/serialNumber/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err17];}else {vErrors.push(err17);}errors++;}var valid10 = _errs40 === errors;}else {var valid10 = true;}if(valid10){if(data5.subjectDN !== undefined){const _errs42 = errors;if(typeof data5.subjectDN !== "string"){const err18 = {instancePath:instancePath+"/clientCert/subjectDN",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/subjectDN/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err18];}else {vErrors.push(err18);}errors++;}var valid10 = _errs42 === errors;}else {var valid10 = true;}if(valid10){if(data5.issuerDN !== undefined){const _errs44 = errors;if(typeof data5.issuerDN !== "string"){const err19 = {instancePath:instancePath+"/clientCert/issuerDN",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/issuerDN/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err19];}else {vErrors.push(err19);}errors++;}var valid10 = _errs44 === errors;}else {var valid10 = true;}if(valid10){if(data5.validity !== undefined){let data10 = data5.validity;const _errs46 = errors;if(errors === _errs46){if(data10 && typeof data10 == "object" && !Array.isArray(data10)){let missing2;if(((data10.notAfter === undefined) && (missing2 = "notAfter")) || ((data10.notBefore === undefined) && (missing2 = "notBefore"))){const err20 = {instancePath:instancePath+"/clientCert/validity",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/validity/required",keyword:"required",params:{missingProperty: missing2},message:"must have required property '"+missing2+"'"};if(vErrors === null){vErrors = [err20];}else {vErrors.push(err20);}errors++;}else {if(data10.notAfter !== undefined){const _errs49 = errors;if(typeof data10.notAfter !== "string"){const err21 = {instancePath:instancePath+"/clientCert/validity/notAfter",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/validity/properties/notAfter/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err21];}else {vErrors.push(err21);}errors++;}var valid11 = _errs49 === errors;}else {var valid11 = true;}if(valid11){if(data10.notBefore !== undefined){const _errs51 = errors;if(typeof data10.notBefore !== "string"){const err22 = {instancePath:instancePath+"/clientCert/validity/notBefore",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/validity/properties/notBefore/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err22];}else {vErrors.push(err22);}errors++;}var valid11 = _errs51 === errors;}else {var valid11 = true;}}}}else {const err23 = {instancePath:instancePath+"/clientCert/validity",schemaPath:"#/$defs/APIGatewayEventClientCertificate/properties/validity/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err23];}else {vErrors.push(err23);}errors++;}}var valid10 = _errs46 === errors;}else {var valid10 = true;}}}}}}}else {const err24 = {instancePath:instancePath+"/clientCert",schemaPath:"#/$defs/APIGatewayEventClientCertificate/type",keyword:"type",params:{type: "object"},message:"must be object"};if(vErrors === null){vErrors = [err24];}else {vErrors.push(err24);}errors++;}}var _valid5 = _errs34 === errors;valid7 = valid7 || _valid5;if(!valid7){const _errs53 = errors;if(data5 !== null){const err25 = {instancePath:instancePath+"/clientCert",schemaPath:"#/properties/clientCert/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err25];}else {vErrors.push(err25);}errors++;}var _valid5 = _errs53 === errors;valid7 = valid7 || _valid5;}if(!valid7){const err26 = {instancePath:instancePath+"/clientCert",schemaPath:"#/properties/clientCert/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err26];}else {vErrors.push(err26);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs33;if(vErrors !== null){if(_errs33){vErrors.length = _errs33;}else {vErrors = null;}}}var valid1 = _errs32 === errors;}else {var valid1 = true;}if(valid1){if(data.cognitoAuthenticationProvider !== undefined){let data13 = data.cognitoAuthenticationProvider;const _errs55 = errors;const _errs56 = errors;let valid12 = false;const _errs57 = errors;if(typeof data13 !== "string"){const err27 = {instancePath:instancePath+"/cognitoAuthenticationProvider",schemaPath:"#/properties/cognitoAuthenticationProvider/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err27];}else {vErrors.push(err27);}errors++;}var _valid6 = _errs57 === errors;valid12 = valid12 || _valid6;if(!valid12){const _errs59 = errors;if(data13 !== null){const err28 = {instancePath:instancePath+"/cognitoAuthenticationProvider",schemaPath:"#/properties/cognitoAuthenticationProvider/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err28];}else {vErrors.push(err28);}errors++;}var _valid6 = _errs59 === errors;valid12 = valid12 || _valid6;}if(!valid12){const err29 = {instancePath:instancePath+"/cognitoAuthenticationProvider",schemaPath:"#/properties/cognitoAuthenticationProvider/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err29];}else {vErrors.push(err29);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs56;if(vErrors !== null){if(_errs56){vErrors.length = _errs56;}else {vErrors = null;}}}var valid1 = _errs55 === errors;}else {var valid1 = true;}if(valid1){if(data.cognitoAuthenticationType !== undefined){let data14 = data.cognitoAuthenticationType;const _errs61 = errors;const _errs62 = errors;let valid13 = false;const _errs63 = errors;if(typeof data14 !== "string"){const err30 = {instancePath:instancePath+"/cognitoAuthenticationType",schemaPath:"#/properties/cognitoAuthenticationType/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err30];}else {vErrors.push(err30);}errors++;}var _valid7 = _errs63 === errors;valid13 = valid13 || _valid7;if(!valid13){const _errs65 = errors;if(data14 !== null){const err31 = {instancePath:instancePath+"/cognitoAuthenticationType",schemaPath:"#/properties/cognitoAuthenticationType/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err31];}else {vErrors.push(err31);}errors++;}var _valid7 = _errs65 === errors;valid13 = valid13 || _valid7;}if(!valid13){const err32 = {instancePath:instancePath+"/cognitoAuthenticationType",schemaPath:"#/properties/cognitoAuthenticationType/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err32];}else {vErrors.push(err32);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs62;if(vErrors !== null){if(_errs62){vErrors.length = _errs62;}else {vErrors = null;}}}var valid1 = _errs61 === errors;}else {var valid1 = true;}if(valid1){if(data.cognitoIdentityId !== undefined){let data15 = data.cognitoIdentityId;const _errs67 = errors;const _errs68 = errors;let valid14 = false;const _errs69 = errors;if(typeof data15 !== "string"){const err33 = {instancePath:instancePath+"/cognitoIdentityId",schemaPath:"#/properties/cognitoIdentityId/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err33];}else {vErrors.push(err33);}errors++;}var _valid8 = _errs69 === errors;valid14 = valid14 || _valid8;if(!valid14){const _errs71 = errors;if(data15 !== null){const err34 = {instancePath:instancePath+"/cognitoIdentityId",schemaPath:"#/properties/cognitoIdentityId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err34];}else {vErrors.push(err34);}errors++;}var _valid8 = _errs71 === errors;valid14 = valid14 || _valid8;}if(!valid14){const err35 = {instancePath:instancePath+"/cognitoIdentityId",schemaPath:"#/properties/cognitoIdentityId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err35];}else {vErrors.push(err35);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs68;if(vErrors !== null){if(_errs68){vErrors.length = _errs68;}else {vErrors = null;}}}var valid1 = _errs67 === errors;}else {var valid1 = true;}if(valid1){if(data.cognitoIdentityPoolId !== undefined){let data16 = data.cognitoIdentityPoolId;const _errs73 = errors;const _errs74 = errors;let valid15 = false;const _errs75 = errors;if(typeof data16 !== "string"){const err36 = {instancePath:instancePath+"/cognitoIdentityPoolId",schemaPath:"#/properties/cognitoIdentityPoolId/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err36];}else {vErrors.push(err36);}errors++;}var _valid9 = _errs75 === errors;valid15 = valid15 || _valid9;if(!valid15){const _errs77 = errors;if(data16 !== null){const err37 = {instancePath:instancePath+"/cognitoIdentityPoolId",schemaPath:"#/properties/cognitoIdentityPoolId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err37];}else {vErrors.push(err37);}errors++;}var _valid9 = _errs77 === errors;valid15 = valid15 || _valid9;}if(!valid15){const err38 = {instancePath:instancePath+"/cognitoIdentityPoolId",schemaPath:"#/properties/cognitoIdentityPoolId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err38];}else {vErrors.push(err38);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs74;if(vErrors !== null){if(_errs74){vErrors.length = _errs74;}else {vErrors = null;}}}var valid1 = _errs73 === errors;}else {var valid1 = true;}if(valid1){if(data.principalOrgId !== undefined){let data17 = data.principalOrgId;const _errs79 = errors;const _errs80 = errors;let valid16 = false;const _errs81 = errors;if(typeof data17 !== "string"){const err39 = {instancePath:instancePath+"/principalOrgId",schemaPath:"#/properties/principalOrgId/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err39];}else {vErrors.push(err39);}errors++;}var _valid10 = _errs81 === errors;valid16 = valid16 || _valid10;if(!valid16){const _errs83 = errors;if(data17 !== null){const err40 = {instancePath:instancePath+"/principalOrgId",schemaPath:"#/properties/principalOrgId/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err40];}else {vErrors.push(err40);}errors++;}var _valid10 = _errs83 === errors;valid16 = valid16 || _valid10;}if(!valid16){const err41 = {instancePath:instancePath+"/principalOrgId",schemaPath:"#/properties/principalOrgId/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err41];}else {vErrors.push(err41);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs80;if(vErrors !== null){if(_errs80){vErrors.length = _errs80;}else {vErrors = null;}}}var valid1 = _errs79 === errors;}else {var valid1 = true;}if(valid1){if(data.sourceIp !== undefined){const _errs85 = errors;if(typeof data.sourceIp !== "string"){validate11.errors = [{instancePath:instancePath+"/sourceIp",schemaPath:"#/properties/sourceIp/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid1 = _errs85 === errors;}else {var valid1 = true;}if(valid1){if(data.user !== undefined){let data19 = data.user;const _errs87 = errors;const _errs88 = errors;let valid17 = false;const _errs89 = errors;if(typeof data19 !== "string"){const err42 = {instancePath:instancePath+"/user",schemaPath:"#/properties/user/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err42];}else {vErrors.push(err42);}errors++;}var _valid11 = _errs89 === errors;valid17 = valid17 || _valid11;if(!valid17){const _errs91 = errors;if(data19 !== null){const err43 = {instancePath:instancePath+"/user",schemaPath:"#/properties/user/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err43];}else {vErrors.push(err43);}errors++;}var _valid11 = _errs91 === errors;valid17 = valid17 || _valid11;}if(!valid17){const err44 = {instancePath:instancePath+"/user",schemaPath:"#/properties/user/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err44];}else {vErrors.push(err44);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs88;if(vErrors !== null){if(_errs88){vErrors.length = _errs88;}else {vErrors = null;}}}var valid1 = _errs87 === errors;}else {var valid1 = true;}if(valid1){if(data.userAgent !== undefined){let data20 = data.userAgent;const _errs93 = errors;const _errs94 = errors;let valid18 = false;const _errs95 = errors;if(typeof data20 !== "string"){const err45 = {instancePath:instancePath+"/userAgent",schemaPath:"#/properties/userAgent/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err45];}else {vErrors.push(err45);}errors++;}var _valid12 = _errs95 === errors;valid18 = valid18 || _valid12;if(!valid18){const _errs97 = errors;if(data20 !== null){const err46 = {instancePath:instancePath+"/userAgent",schemaPath:"#/properties/userAgent/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err46];}else {vErrors.push(err46);}errors++;}var _valid12 = _errs97 === errors;valid18 = valid18 || _valid12;}if(!valid18){const err47 = {instancePath:instancePath+"/userAgent",schemaPath:"#/properties/userAgent/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err47];}else {vErrors.push(err47);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs94;if(vErrors !== null){if(_errs94){vErrors.length = _errs94;}else {vErrors = null;}}}var valid1 = _errs93 === errors;}else {var valid1 = true;}if(valid1){if(data.userArn !== undefined){let data21 = data.userArn;const _errs99 = errors;const _errs100 = errors;let valid19 = false;const _errs101 = errors;if(typeof data21 !== "string"){const err48 = {instancePath:instancePath+"/userArn",schemaPath:"#/properties/userArn/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err48];}else {vErrors.push(err48);}errors++;}var _valid13 = _errs101 === errors;valid19 = valid19 || _valid13;if(!valid19){const _errs103 = errors;if(data21 !== null){const err49 = {instancePath:instancePath+"/userArn",schemaPath:"#/properties/userArn/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err49];}else {vErrors.push(err49);}errors++;}var _valid13 = _errs103 === errors;valid19 = valid19 || _valid13;}if(!valid19){const err50 = {instancePath:instancePath+"/userArn",schemaPath:"#/properties/userArn/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err50];}else {vErrors.push(err50);}errors++;validate11.errors = vErrors;return false;}else {errors = _errs100;if(vErrors !== null){if(_errs100){vErrors.length = _errs100;}else {vErrors = null;}}}var valid1 = _errs99 === errors;}else {var valid1 = true;}}}}}}}}}}}}}}}}}else {validate11.errors = [{instancePath,schemaPath:"#/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}validate11.errors = vErrors;return errors === 0;}function validate10(data, {instancePath="", parentData, parentDataProperty, rootData=data}={}){let vErrors = null;let errors = 0;if(errors === 0){if(data && typeof data == "object" && !Array.isArray(data)){let missing0;let valid0 = true;for( missing0 of schema11.required){valid0 = data[missing0] !== undefined;if(!valid0){validate10.errors = [{instancePath,schemaPath:"#/required",keyword:"required",params:{missingProperty: missing0},message:"must have required property '"+missing0+"'"}];return false;break;}}if(valid0){if(data.body !== undefined){let data0 = data.body;const _errs2 = errors;const _errs3 = errors;let valid2 = false;const _errs4 = errors;if(typeof data0 !== "string"){const err0 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/anyOf/0/type",keyword:"type",params:{type: "string"},message:"must be string"};if(vErrors === null){vErrors = [err0];}else {vErrors.push(err0);}errors++;}var _valid0 = _errs4 === errors;valid2 = valid2 || _valid0;if(!valid2){const _errs6 = errors;if(data0 !== null){const err1 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/anyOf/1/type",keyword:"type",params:{type: "null"},message:"must be null"};if(vErrors === null){vErrors = [err1];}else {vErrors.push(err1);}errors++;}var _valid0 = _errs6 === errors;valid2 = valid2 || _valid0;}if(!valid2){const err2 = {instancePath:instancePath+"/body",schemaPath:"#/properties/body/anyOf",keyword:"anyOf",params:{},message:"must match a schema in anyOf"};if(vErrors === null){vErrors = [err2];}else {vErrors.push(err2);}errors++;validate10.errors = vErrors;return false;}else {errors = _errs3;if(vErrors !== null){if(_errs3){vErrors.length = _errs3;}else {vErrors = null;}}}var valid1 = _errs2 === errors;}else {var valid1 = true;}if(valid1){if(data.headers !== undefined){let data1 = data.headers;const _errs8 = errors;const _errs9 = errors;if(errors === _errs9){if(data1 && typeof data1 == "object" && !Array.isArray(data1)){for(const key0 in data1){const _errs12 = errors;if(typeof data1[key0] !== "string"){validate10.errors = [{instancePath:instancePath+"/headers/" + key0.replace(/~/g, "~0").replace(/\//g, "~1"),schemaPath:"#/$defs/APIGatewayProxyEventHeaders/additionalProperties/type",keyword:"type",params:{type: "string"},message:"must be string"}];return false;}var valid4 = _errs12 === errors;if(!valid4){break;}}}else {validate10.errors = [{instancePath:instancePath+"/headers",schemaPath:"#/$defs/APIGatewayProxyEventHeaders/type",keyword:"type",params:{type: "object"},message:"must be object"}];return false;}}var valid1 = _errs8 === errors;}else {var valid1 = true;}if(valid1){if(data.multiValueHeaders !== undefined){let data3 = data.multiValueHeaders;const _errs14 = errors;const _errs15 = errors;if(errors === _errs15){if(data3 && typeof data3 == "object" && !Array.isArray(data3)){for(const key1 in data3){let data4 = data3[key1];const _errs18 = errors;if(errors === _errs18){if(Array.isArray(data4)){var valid7 = true;const len0 = data4.length;for(let i0=0; i0