@@ -21,74 +21,74 @@ class ApiGatewayUserCert(BaseModel):
21
21
22
22
23
23
class APIGatewayEventIdentity (BaseModel ):
24
- accessKey : Optional [str ]
25
- accountId : Optional [str ]
26
- apiKey : Optional [str ]
27
- apiKeyId : Optional [str ]
28
- caller : Optional [str ]
29
- cognitoAuthenticationProvider : Optional [str ]
30
- cognitoAuthenticationType : Optional [str ]
31
- cognitoIdentityId : Optional [str ]
32
- cognitoIdentityPoolId : Optional [str ]
33
- principalOrgId : Optional [str ]
24
+ accessKey : Optional [str ] = None
25
+ accountId : Optional [str ] = None
26
+ apiKey : Optional [str ] = None
27
+ apiKeyId : Optional [str ] = None
28
+ caller : Optional [str ] = None
29
+ cognitoAuthenticationProvider : Optional [str ] = None
30
+ cognitoAuthenticationType : Optional [str ] = None
31
+ cognitoIdentityId : Optional [str ] = None
32
+ cognitoIdentityPoolId : Optional [str ] = None
33
+ principalOrgId : Optional [str ] = None
34
34
# see #1562, temp workaround until API Gateway fixes it the Test button payload
35
35
# removing it will not be considered a regression in the future
36
36
sourceIp : Union [IPvAnyNetwork , Literal ["test-invoke-source-ip" ]]
37
- user : Optional [str ]
38
- userAgent : Optional [str ]
39
- userArn : Optional [str ]
40
- clientCert : Optional [ApiGatewayUserCert ]
37
+ user : Optional [str ] = None
38
+ userAgent : Optional [str ] = None
39
+ userArn : Optional [str ] = None
40
+ clientCert : Optional [ApiGatewayUserCert ] = None
41
41
42
42
43
43
class APIGatewayEventAuthorizer (BaseModel ):
44
- claims : Optional [Dict [str , Any ]]
45
- scopes : Optional [List [str ]]
44
+ claims : Optional [Dict [str , Any ]] = None
45
+ scopes : Optional [List [str ]] = None
46
46
47
47
48
48
class APIGatewayEventRequestContext (BaseModel ):
49
49
accountId : str
50
50
apiId : str
51
- authorizer : Optional [APIGatewayEventAuthorizer ]
51
+ authorizer : Optional [APIGatewayEventAuthorizer ] = None
52
52
stage : str
53
53
protocol : str
54
54
identity : APIGatewayEventIdentity
55
55
requestId : str
56
56
requestTime : str
57
57
requestTimeEpoch : datetime
58
- resourceId : Optional [str ]
58
+ resourceId : Optional [str ] = None
59
59
resourcePath : str
60
- domainName : Optional [str ]
61
- domainPrefix : Optional [str ]
62
- extendedRequestId : Optional [str ]
60
+ domainName : Optional [str ] = None
61
+ domainPrefix : Optional [str ] = None
62
+ extendedRequestId : Optional [str ] = None
63
63
httpMethod : Literal ["DELETE" , "GET" , "HEAD" , "OPTIONS" , "PATCH" , "POST" , "PUT" ]
64
64
path : str
65
- connectedAt : Optional [datetime ]
66
- connectionId : Optional [str ]
67
- eventType : Optional [Literal ["CONNECT" , "MESSAGE" , "DISCONNECT" ]]
68
- messageDirection : Optional [str ]
69
- messageId : Optional [str ]
70
- routeKey : Optional [str ]
71
- operationName : Optional [str ]
65
+ connectedAt : Optional [datetime ] = None
66
+ connectionId : Optional [str ] = None
67
+ eventType : Optional [Literal ["CONNECT" , "MESSAGE" , "DISCONNECT" ]] = None
68
+ messageDirection : Optional [str ] = None
69
+ messageId : Optional [str ] = None
70
+ routeKey : Optional [str ] = None
71
+ operationName : Optional [str ] = None
72
72
73
- @root_validator (allow_reuse = True )
73
+ @root_validator (allow_reuse = True , skip_on_failure = True )
74
74
def check_message_id (cls , values ):
75
75
message_id , event_type = values .get ("messageId" ), values .get ("eventType" )
76
76
if message_id is not None and event_type != "MESSAGE" :
77
- raise TypeError ("messageId is available only when the `eventType` is `MESSAGE`" )
77
+ raise ValueError ("messageId is available only when the `eventType` is `MESSAGE`" )
78
78
return values
79
79
80
80
81
81
class APIGatewayProxyEventModel (BaseModel ):
82
- version : Optional [str ]
82
+ version : Optional [str ] = None
83
83
resource : str
84
84
path : str
85
85
httpMethod : Literal ["DELETE" , "GET" , "HEAD" , "OPTIONS" , "PATCH" , "POST" , "PUT" ]
86
86
headers : Dict [str , str ]
87
87
multiValueHeaders : Dict [str , List [str ]]
88
- queryStringParameters : Optional [Dict [str , str ]]
89
- multiValueQueryStringParameters : Optional [Dict [str , List [str ]]]
88
+ queryStringParameters : Optional [Dict [str , str ]] = None
89
+ multiValueQueryStringParameters : Optional [Dict [str , List [str ]]] = None
90
90
requestContext : APIGatewayEventRequestContext
91
- pathParameters : Optional [Dict [str , str ]]
92
- stageVariables : Optional [Dict [str , str ]]
91
+ pathParameters : Optional [Dict [str , str ]] = None
92
+ stageVariables : Optional [Dict [str , str ]] = None
93
93
isBase64Encoded : bool
94
- body : Optional [Union [str , Type [BaseModel ]]]
94
+ body : Optional [Union [str , Type [BaseModel ]]] = None
0 commit comments