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