11"""OpenAPI core app module"""
22
3+ from functools import cached_property
34from pathlib import Path
45from typing import Optional
56
@@ -142,55 +143,55 @@ def check_spec(self) -> None:
142143 def version (self ) -> SpecVersion :
143144 return self ._get_version ()
144145
145- @property
146+ @cached_property
146147 def request_validator_cls (self ) -> Optional [RequestValidatorType ]:
147148 if not isinstance (self .config .request_validator_cls , Unset ):
148149 return self .config .request_validator_cls
149150 return REQUEST_VALIDATORS .get (self .version )
150151
151- @property
152+ @cached_property
152153 def response_validator_cls (self ) -> Optional [ResponseValidatorType ]:
153154 if not isinstance (self .config .response_validator_cls , Unset ):
154155 return self .config .response_validator_cls
155156 return RESPONSE_VALIDATORS .get (self .version )
156157
157- @property
158+ @cached_property
158159 def webhook_request_validator_cls (
159160 self ,
160161 ) -> Optional [WebhookRequestValidatorType ]:
161162 if not isinstance (self .config .webhook_request_validator_cls , Unset ):
162163 return self .config .webhook_request_validator_cls
163164 return WEBHOOK_REQUEST_VALIDATORS .get (self .version )
164165
165- @property
166+ @cached_property
166167 def webhook_response_validator_cls (
167168 self ,
168169 ) -> Optional [WebhookResponseValidatorType ]:
169170 if not isinstance (self .config .webhook_response_validator_cls , Unset ):
170171 return self .config .webhook_response_validator_cls
171172 return WEBHOOK_RESPONSE_VALIDATORS .get (self .version )
172173
173- @property
174+ @cached_property
174175 def request_unmarshaller_cls (self ) -> Optional [RequestUnmarshallerType ]:
175176 if not isinstance (self .config .request_unmarshaller_cls , Unset ):
176177 return self .config .request_unmarshaller_cls
177178 return REQUEST_UNMARSHALLERS .get (self .version )
178179
179- @property
180+ @cached_property
180181 def response_unmarshaller_cls (self ) -> Optional [ResponseUnmarshallerType ]:
181182 if not isinstance (self .config .response_unmarshaller_cls , Unset ):
182183 return self .config .response_unmarshaller_cls
183184 return RESPONSE_UNMARSHALLERS .get (self .version )
184185
185- @property
186+ @cached_property
186187 def webhook_request_unmarshaller_cls (
187188 self ,
188189 ) -> Optional [WebhookRequestUnmarshallerType ]:
189190 if not isinstance (self .config .webhook_request_unmarshaller_cls , Unset ):
190191 return self .config .webhook_request_unmarshaller_cls
191192 return WEBHOOK_REQUEST_UNMARSHALLERS .get (self .version )
192193
193- @property
194+ @cached_property
194195 def webhook_response_unmarshaller_cls (
195196 self ,
196197 ) -> Optional [WebhookResponseUnmarshallerType ]:
@@ -200,7 +201,7 @@ def webhook_response_unmarshaller_cls(
200201 return self .config .webhook_response_unmarshaller_cls
201202 return WEBHOOK_RESPONSE_UNMARSHALLERS .get (self .version )
202203
203- @property
204+ @cached_property
204205 def request_validator (self ) -> RequestValidator :
205206 if self .request_validator_cls is None :
206207 raise SpecError ("Validator class not found" )
@@ -211,13 +212,14 @@ def request_validator(self) -> RequestValidator:
211212 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
212213 schema_casters_factory = self .config .schema_casters_factory ,
213214 schema_validators_factory = self .config .schema_validators_factory ,
215+ path_finder_cls = self .config .apicall_path_finder_cls ,
214216 spec_validator_cls = self .config .spec_validator_cls ,
215217 extra_format_validators = self .config .extra_format_validators ,
216218 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
217219 security_provider_factory = self .config .security_provider_factory ,
218220 )
219221
220- @property
222+ @cached_property
221223 def response_validator (self ) -> ResponseValidator :
222224 if self .response_validator_cls is None :
223225 raise SpecError ("Validator class not found" )
@@ -228,12 +230,13 @@ def response_validator(self) -> ResponseValidator:
228230 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
229231 schema_casters_factory = self .config .schema_casters_factory ,
230232 schema_validators_factory = self .config .schema_validators_factory ,
233+ path_finder_cls = self .config .apicall_path_finder_cls ,
231234 spec_validator_cls = self .config .spec_validator_cls ,
232235 extra_format_validators = self .config .extra_format_validators ,
233236 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
234237 )
235238
236- @property
239+ @cached_property
237240 def webhook_request_validator (self ) -> WebhookRequestValidator :
238241 if self .webhook_request_validator_cls is None :
239242 raise SpecError ("Validator class not found" )
@@ -244,13 +247,14 @@ def webhook_request_validator(self) -> WebhookRequestValidator:
244247 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
245248 schema_casters_factory = self .config .schema_casters_factory ,
246249 schema_validators_factory = self .config .schema_validators_factory ,
250+ path_finder_cls = self .config .webhook_path_finder_cls ,
247251 spec_validator_cls = self .config .spec_validator_cls ,
248252 extra_format_validators = self .config .extra_format_validators ,
249253 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
250254 security_provider_factory = self .config .security_provider_factory ,
251255 )
252256
253- @property
257+ @cached_property
254258 def webhook_response_validator (self ) -> WebhookResponseValidator :
255259 if self .webhook_response_validator_cls is None :
256260 raise SpecError ("Validator class not found" )
@@ -261,12 +265,13 @@ def webhook_response_validator(self) -> WebhookResponseValidator:
261265 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
262266 schema_casters_factory = self .config .schema_casters_factory ,
263267 schema_validators_factory = self .config .schema_validators_factory ,
268+ path_finder_cls = self .config .webhook_path_finder_cls ,
264269 spec_validator_cls = self .config .spec_validator_cls ,
265270 extra_format_validators = self .config .extra_format_validators ,
266271 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
267272 )
268273
269- @property
274+ @cached_property
270275 def request_unmarshaller (self ) -> RequestUnmarshaller :
271276 if self .request_unmarshaller_cls is None :
272277 raise SpecError ("Unmarshaller class not found" )
@@ -277,6 +282,7 @@ def request_unmarshaller(self) -> RequestUnmarshaller:
277282 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
278283 schema_casters_factory = self .config .schema_casters_factory ,
279284 schema_validators_factory = self .config .schema_validators_factory ,
285+ path_finder_cls = self .config .apicall_path_finder_cls ,
280286 spec_validator_cls = self .config .spec_validator_cls ,
281287 extra_format_validators = self .config .extra_format_validators ,
282288 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
@@ -285,7 +291,7 @@ def request_unmarshaller(self) -> RequestUnmarshaller:
285291 extra_format_unmarshallers = self .config .extra_format_unmarshallers ,
286292 )
287293
288- @property
294+ @cached_property
289295 def response_unmarshaller (self ) -> ResponseUnmarshaller :
290296 if self .response_unmarshaller_cls is None :
291297 raise SpecError ("Unmarshaller class not found" )
@@ -296,14 +302,15 @@ def response_unmarshaller(self) -> ResponseUnmarshaller:
296302 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
297303 schema_casters_factory = self .config .schema_casters_factory ,
298304 schema_validators_factory = self .config .schema_validators_factory ,
305+ path_finder_cls = self .config .apicall_path_finder_cls ,
299306 spec_validator_cls = self .config .spec_validator_cls ,
300307 extra_format_validators = self .config .extra_format_validators ,
301308 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
302309 schema_unmarshallers_factory = self .config .schema_unmarshallers_factory ,
303310 extra_format_unmarshallers = self .config .extra_format_unmarshallers ,
304311 )
305312
306- @property
313+ @cached_property
307314 def webhook_request_unmarshaller (self ) -> WebhookRequestUnmarshaller :
308315 if self .webhook_request_unmarshaller_cls is None :
309316 raise SpecError ("Unmarshaller class not found" )
@@ -314,6 +321,7 @@ def webhook_request_unmarshaller(self) -> WebhookRequestUnmarshaller:
314321 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
315322 schema_casters_factory = self .config .schema_casters_factory ,
316323 schema_validators_factory = self .config .schema_validators_factory ,
324+ path_finder_cls = self .config .webhook_path_finder_cls ,
317325 spec_validator_cls = self .config .spec_validator_cls ,
318326 extra_format_validators = self .config .extra_format_validators ,
319327 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
@@ -322,7 +330,7 @@ def webhook_request_unmarshaller(self) -> WebhookRequestUnmarshaller:
322330 extra_format_unmarshallers = self .config .extra_format_unmarshallers ,
323331 )
324332
325- @property
333+ @cached_property
326334 def webhook_response_unmarshaller (self ) -> WebhookResponseUnmarshaller :
327335 if self .webhook_response_unmarshaller_cls is None :
328336 raise SpecError ("Unmarshaller class not found" )
@@ -333,6 +341,7 @@ def webhook_response_unmarshaller(self) -> WebhookResponseUnmarshaller:
333341 media_type_deserializers_factory = self .config .media_type_deserializers_factory ,
334342 schema_casters_factory = self .config .schema_casters_factory ,
335343 schema_validators_factory = self .config .schema_validators_factory ,
344+ path_finder_cls = self .config .webhook_path_finder_cls ,
336345 spec_validator_cls = self .config .spec_validator_cls ,
337346 extra_format_validators = self .config .extra_format_validators ,
338347 extra_media_type_deserializers = self .config .extra_media_type_deserializers ,
0 commit comments