@@ -17,9 +17,11 @@ def validator(
17
17
inbound_schema : Optional [Dict ] = None ,
18
18
inbound_formats : Optional [Dict ] = None ,
19
19
inbound_handlers : Optional [Dict ] = None ,
20
+ inbound_provider_options : Dict = {},
20
21
outbound_schema : Optional [Dict ] = None ,
21
22
outbound_formats : Optional [Dict ] = None ,
22
23
outbound_handlers : Optional [Dict ] = None ,
24
+ outbound_provider_options : Dict = {},
23
25
envelope : str = "" ,
24
26
jmespath_options : Optional [Dict ] = None ,
25
27
** kwargs : Any ,
@@ -50,6 +52,10 @@ def validator(
50
52
Custom methods to retrieve remote schemes, keyed off of URI scheme
51
53
outbound_handlers: Dict
52
54
Custom methods to retrieve remote schemes, keyed off of URI scheme
55
+ inbound_provider_options: Dict
56
+ Arguments that will be passed directly to the underlying validate call for the inbound event
57
+ outbound_provider_options: Dict
58
+ Arguments that will be passed directly to the underlying validate call for the outbound event
53
59
54
60
Example
55
61
-------
@@ -134,15 +140,23 @@ def handler(event, context):
134
140
if inbound_schema :
135
141
logger .debug ("Validating inbound event" )
136
142
validate_data_against_schema (
137
- data = event , schema = inbound_schema , formats = inbound_formats , handlers = inbound_handlers
143
+ data = event ,
144
+ schema = inbound_schema ,
145
+ formats = inbound_formats ,
146
+ handlers = inbound_handlers ,
147
+ ** inbound_provider_options ,
138
148
)
139
149
140
150
response = handler (event , context , ** kwargs )
141
151
142
152
if outbound_schema :
143
153
logger .debug ("Validating outbound event" )
144
154
validate_data_against_schema (
145
- data = response , schema = outbound_schema , formats = outbound_formats , handlers = outbound_handlers
155
+ data = response ,
156
+ schema = outbound_schema ,
157
+ formats = outbound_formats ,
158
+ handlers = outbound_handlers ,
159
+ ** outbound_provider_options ,
146
160
)
147
161
148
162
return response
@@ -153,6 +167,7 @@ def validate(
153
167
schema : Dict ,
154
168
formats : Optional [Dict ] = None ,
155
169
handlers : Optional [Dict ] = None ,
170
+ provider_options : Dict = {},
156
171
envelope : Optional [str ] = None ,
157
172
jmespath_options : Optional [Dict ] = None ,
158
173
):
@@ -174,6 +189,8 @@ def validate(
174
189
Custom formats containing a key (e.g. int64) and a value expressed as regex or callback returning bool
175
190
handlers: Dict
176
191
Custom methods to retrieve remote schemes, keyed off of URI scheme
192
+ provider_options: Dict
193
+ Arguments that will be passed directly to the underlying validate call
177
194
178
195
Example
179
196
-------
@@ -242,4 +259,4 @@ def handler(event, context):
242
259
jmespath_options = jmespath_options ,
243
260
)
244
261
245
- validate_data_against_schema (data = event , schema = schema , formats = formats , handlers = handlers )
262
+ validate_data_against_schema (data = event , schema = schema , formats = formats , handlers = handlers , ** provider_options )
0 commit comments