cadwyn 5.4.1__py3-none-any.whl → 5.4.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of cadwyn might be problematic. Click here for more details.
- cadwyn/schema_generation.py +25 -9
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.2.dist-info}/METADATA +1 -1
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.2.dist-info}/RECORD +6 -6
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.2.dist-info}/WHEEL +0 -0
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.2.dist-info}/entry_points.txt +0 -0
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.2.dist-info}/licenses/LICENSE +0 -0
cadwyn/schema_generation.py
CHANGED
|
@@ -236,6 +236,11 @@ def _wrap_validator(func: Callable, is_pydantic_v1_style_validator: Any, decorat
|
|
|
236
236
|
func = func.__func__
|
|
237
237
|
kwargs = dataclasses.asdict(decorator_info)
|
|
238
238
|
decorator_fields = kwargs.pop("fields", None)
|
|
239
|
+
|
|
240
|
+
# wrapped_property is not accepted by computed_field()
|
|
241
|
+
if isinstance(decorator_info, ComputedFieldInfo):
|
|
242
|
+
kwargs.pop("wrapped_property", None)
|
|
243
|
+
|
|
239
244
|
actual_decorator = PYDANTIC_DECORATOR_TYPE_TO_DECORATOR_MAP[type(decorator_info)]
|
|
240
245
|
if is_pydantic_v1_style_validator:
|
|
241
246
|
# There's an inconsistency in their interfaces so we gotta resort to this
|
|
@@ -1061,19 +1066,30 @@ def _delete_field_attributes(
|
|
|
1061
1066
|
|
|
1062
1067
|
|
|
1063
1068
|
def _delete_field_from_model(model: _PydanticModelWrapper, field_name: str, version_change_name: str):
|
|
1064
|
-
if field_name
|
|
1069
|
+
if field_name in model.fields:
|
|
1070
|
+
model.fields.pop(field_name)
|
|
1071
|
+
model.annotations.pop(field_name)
|
|
1072
|
+
for validator_name, validator in model.validators.copy().items():
|
|
1073
|
+
if isinstance(validator, _PerFieldValidatorWrapper) and field_name in validator.fields:
|
|
1074
|
+
validator.fields.remove(field_name)
|
|
1075
|
+
# TODO: This behavior doesn't feel natural
|
|
1076
|
+
if not validator.fields:
|
|
1077
|
+
model.validators[validator_name].is_deleted = True
|
|
1078
|
+
|
|
1079
|
+
elif (
|
|
1080
|
+
field_name in model.validators
|
|
1081
|
+
and isinstance(model.validators[field_name], _ValidatorWrapper)
|
|
1082
|
+
and hasattr(model.validators[field_name], "decorator")
|
|
1083
|
+
and model.validators[field_name].decorator == pydantic.computed_field
|
|
1084
|
+
):
|
|
1085
|
+
validator = model.validators[field_name]
|
|
1086
|
+
model.validators[field_name].is_deleted = True
|
|
1087
|
+
model.annotations.pop(field_name, None)
|
|
1088
|
+
else:
|
|
1065
1089
|
raise InvalidGenerationInstructionError(
|
|
1066
1090
|
f'You tried to delete a field "{field_name}" from "{model.name}" '
|
|
1067
1091
|
f'in "{version_change_name}" but it doesn\'t have such a field.',
|
|
1068
1092
|
)
|
|
1069
|
-
model.fields.pop(field_name)
|
|
1070
|
-
model.annotations.pop(field_name)
|
|
1071
|
-
for validator_name, validator in model.validators.copy().items():
|
|
1072
|
-
if isinstance(validator, _PerFieldValidatorWrapper) and field_name in validator.fields:
|
|
1073
|
-
validator.fields.remove(field_name)
|
|
1074
|
-
# TODO: This behavior doesn't feel natural
|
|
1075
|
-
if not validator.fields:
|
|
1076
|
-
model.validators[validator_name].is_deleted = True
|
|
1077
1093
|
|
|
1078
1094
|
|
|
1079
1095
|
class _DummyEnum(Enum):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 5.4.
|
|
3
|
+
Version: 5.4.2
|
|
4
4
|
Summary: Production-ready community-driven modern Stripe-like API versioning in FastAPI
|
|
5
5
|
Project-URL: Source code, https://github.com/zmievsa/cadwyn
|
|
6
6
|
Project-URL: Documentation, https://docs.cadwyn.dev
|
|
@@ -12,7 +12,7 @@ cadwyn/middleware.py,sha256=4Ziq1ysnc8j5KmeZpsr9VJKllEFC8uYwXnG01I2FPR4,4853
|
|
|
12
12
|
cadwyn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
13
13
|
cadwyn/route_generation.py,sha256=conoTBtsOtjyiV2NdUxwGQX-h1zLyIjDQjD5bT2YSgg,27185
|
|
14
14
|
cadwyn/routing.py,sha256=Ii6Qbgm9lGks1IAk-kDuIu_dX3FXsA77KSfGOFmLbgc,7604
|
|
15
|
-
cadwyn/schema_generation.py,sha256=
|
|
15
|
+
cadwyn/schema_generation.py,sha256=0Z81yHYk1aqE6aGsPCkaPI9IbmiHBlwbVBrfILuUNa0,47531
|
|
16
16
|
cadwyn/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
17
17
|
cadwyn/_internal/context_vars.py,sha256=VcM8eAoSlvrIMFQhjZmjflV5o1yrPSEZZGkwOK4OSf4,378
|
|
18
18
|
cadwyn/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -24,8 +24,8 @@ cadwyn/structure/endpoints.py,sha256=zUgzglNhBPnmWdJ03A8pFT4zPs_lj8nQ7c7Uo2d-ejU
|
|
|
24
24
|
cadwyn/structure/enums.py,sha256=4FCc9aniLE3VuWAVIacrNP_FWxTIUm9JkeeHA_zZdwQ,1254
|
|
25
25
|
cadwyn/structure/schemas.py,sha256=kuQJg60VpWHZkSPvrbvd9pe-Zetq8as5YYrERsG3IE8,10785
|
|
26
26
|
cadwyn/structure/versions.py,sha256=IrtX8sGswjNc8z_6HsU9Im-U7-agZB_pFaqSHz_0SMk,34710
|
|
27
|
-
cadwyn-5.4.
|
|
28
|
-
cadwyn-5.4.
|
|
29
|
-
cadwyn-5.4.
|
|
30
|
-
cadwyn-5.4.
|
|
31
|
-
cadwyn-5.4.
|
|
27
|
+
cadwyn-5.4.2.dist-info/METADATA,sha256=pqS5cVGiRcTECZOoae2zWcDJpyQnSi2GNJ5TbWc0CvY,4504
|
|
28
|
+
cadwyn-5.4.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
cadwyn-5.4.2.dist-info/entry_points.txt,sha256=mGX8wl-Xfhpr5M93SUmkykaqinUaYAvW9rtDSX54gx0,47
|
|
30
|
+
cadwyn-5.4.2.dist-info/licenses/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
|
|
31
|
+
cadwyn-5.4.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|