File tree Expand file tree Collapse file tree 2 files changed +5
-3
lines changed
aws_lambda_powertools/utilities/validation Expand file tree Collapse file tree 2 files changed +5
-3
lines changed Original file line number Diff line number Diff line change 11
11
logger = logging .getLogger (__name__ )
12
12
13
13
14
- def validate_data_against_schema (data : Dict , schema : Dict , formats : Dict ):
14
+ def validate_data_against_schema (data : Dict , schema : Dict , formats : Dict = {} ):
15
15
"""Validate dict data against given JSON Schema
16
16
17
17
Parameters
Original file line number Diff line number Diff line change @@ -13,7 +13,9 @@ def validator(
13
13
event : Union [Dict , str ],
14
14
context : Any ,
15
15
inbound_schema : Dict = None ,
16
+ inbound_formats : Dict = {},
16
17
outbound_schema : Dict = None ,
18
+ outbound_formats : Dict = {},
17
19
envelope : str = None ,
18
20
jmespath_options : Dict = None ,
19
21
) -> Any :
@@ -114,13 +116,13 @@ def handler(event, context):
114
116
115
117
if inbound_schema :
116
118
logger .debug ("Validating inbound event" )
117
- validate_data_against_schema (data = event , schema = inbound_schema )
119
+ validate_data_against_schema (data = event , schema = inbound_schema , formats = inbound_formats )
118
120
119
121
response = handler (event , context )
120
122
121
123
if outbound_schema :
122
124
logger .debug ("Validating outbound event" )
123
- validate_data_against_schema (data = response , schema = outbound_schema )
125
+ validate_data_against_schema (data = response , schema = outbound_schema , formats = outbound_formats )
124
126
125
127
return response
126
128
You can’t perform that action at this time.
0 commit comments