From 3944baa4b276d638fbcd7fc75f885ceeb59e85b2 Mon Sep 17 00:00:00 2001 From: Yugo Kato Date: Thu, 26 Sep 2024 09:54:24 -0700 Subject: [PATCH] Change to generate a signature value of Constraint.pattern as a raw string --- .../libraries/api/api_functions/utils/param_type.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/openapi_test_client/libraries/api/api_functions/utils/param_type.py b/src/openapi_test_client/libraries/api/api_functions/utils/param_type.py index eae4c9c..daa3b84 100644 --- a/src/openapi_test_client/libraries/api/api_functions/utils/param_type.py +++ b/src/openapi_test_client/libraries/api/api_functions/utils/param_type.py @@ -52,7 +52,9 @@ def get_type_annotation_as_str(tp: Any) -> str: elif isinstance(tp, (Alias, Format)): return f"{type(tp).__name__}({repr(tp.value)})" elif isinstance(tp, Constraint): - const = ", ".join(f"{k}={repr(v)}" for k, v in asdict(tp).items() if v is not None) + const = ", ".join( + f'{k}={("r" + repr(v) if k == "pattern" else repr(v))}' for k, v in asdict(tp).items() if v is not None + ) return f"{type(tp).__name__}({const})" elif tp is NoneType: return "None"