cadwyn 5.4.1__py3-none-any.whl → 5.4.3__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/applications.py +3 -2
- cadwyn/schema_generation.py +25 -9
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.3.dist-info}/METADATA +24 -1
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.3.dist-info}/RECORD +7 -7
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.3.dist-info}/WHEEL +0 -0
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.3.dist-info}/entry_points.txt +0 -0
- {cadwyn-5.4.1.dist-info → cadwyn-5.4.3.dist-info}/licenses/LICENSE +0 -0
cadwyn/applications.py
CHANGED
|
@@ -5,6 +5,7 @@ from datetime import date
|
|
|
5
5
|
from logging import getLogger
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import TYPE_CHECKING, Annotated, Any, Optional, Union, cast
|
|
8
|
+
from urllib.parse import quote
|
|
8
9
|
|
|
9
10
|
import fastapi
|
|
10
11
|
from fastapi import APIRouter, FastAPI, HTTPException, routing
|
|
@@ -389,7 +390,7 @@ class Cadwyn(FastAPI):
|
|
|
389
390
|
|
|
390
391
|
if version:
|
|
391
392
|
root_path = self._extract_root_path(req)
|
|
392
|
-
openapi_url = root_path + f"{self.openapi_url}?version={version}"
|
|
393
|
+
openapi_url = root_path + f"{self.openapi_url}?version={quote(version, safe='')}"
|
|
393
394
|
oauth2_redirect_url = self.swagger_ui_oauth2_redirect_url
|
|
394
395
|
if oauth2_redirect_url:
|
|
395
396
|
oauth2_redirect_url = root_path + oauth2_redirect_url
|
|
@@ -407,7 +408,7 @@ class Cadwyn(FastAPI):
|
|
|
407
408
|
|
|
408
409
|
if version:
|
|
409
410
|
root_path = self._extract_root_path(req)
|
|
410
|
-
openapi_url = root_path + f"{self.openapi_url}?version={version}"
|
|
411
|
+
openapi_url = root_path + f"{self.openapi_url}?version={quote(version, safe='')}"
|
|
411
412
|
return get_redoc_html(openapi_url=openapi_url, title=f"{self.title} - ReDoc")
|
|
412
413
|
|
|
413
414
|
return self._render_docs_dashboard(req, docs_url=cast("str", self.redoc_url))
|
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.3
|
|
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
|
|
@@ -88,3 +88,26 @@ The [documentation](https://docs.cadwyn.dev) has everything you need to succeed.
|
|
|
88
88
|
## Sponsors
|
|
89
89
|
|
|
90
90
|
These are our gorgeous sponsors. They are using Cadwyn and are sponsoring it through various means. Contact [me](https://github.com/zmievsa) if you would like to become one, too!
|
|
91
|
+
|
|
92
|
+
## Contributors
|
|
93
|
+
|
|
94
|
+
<details>
|
|
95
|
+
|
|
96
|
+
<summary>Thanks goes to these wonderful people:</summary>
|
|
97
|
+
<a href="https://allcontributors.org/docs/en/emoji-key">Emoji Key </a>
|
|
98
|
+
|
|
99
|
+
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
|
|
100
|
+
<!-- prettier-ignore-start -->
|
|
101
|
+
<!-- markdownlint-disable -->
|
|
102
|
+
|
|
103
|
+
<!-- markdownlint-restore -->
|
|
104
|
+
<!-- prettier-ignore-end -->
|
|
105
|
+
|
|
106
|
+
<!-- ALL-CONTRIBUTORS-LIST:END -->
|
|
107
|
+
|
|
108
|
+
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification.
|
|
109
|
+
Contributions are welcome!
|
|
110
|
+
|
|
111
|
+
</details>
|
|
112
|
+
|
|
113
|
+
<!-- contributors-end -->
|
|
@@ -4,7 +4,7 @@ cadwyn/_asts.py,sha256=Gf43snDwH3n86nohu971EGY2YpIV9NlOaB9TFuy-p1Q,5225
|
|
|
4
4
|
cadwyn/_importer.py,sha256=QV6HqODCG9K2oL4Vc15fAqL2-plMvUWw_cgaj4Ln4C8,1075
|
|
5
5
|
cadwyn/_render.py,sha256=VAY2Twd_MfKaC8_X22AMIQd72_UHy87icdAbKL8hd90,5526
|
|
6
6
|
cadwyn/_utils.py,sha256=q_mTtMKTNTDzqCza67XST-jaPSfuTgnFLmOe0dlGeYY,2295
|
|
7
|
-
cadwyn/applications.py,sha256=
|
|
7
|
+
cadwyn/applications.py,sha256=FALDl4v_8dJWdrpHEuvG34C_vfnKKh01rAOiyg5wVak,21200
|
|
8
8
|
cadwyn/changelogs.py,sha256=5S0yt94LAi2ani_uk-BGR_rK247IYWbZ3NvGmwnL7es,19632
|
|
9
9
|
cadwyn/dependencies.py,sha256=phUJ4Fy3UTegpOfDfHMjxsvASWo-1NQgwqphNnPdoVQ,241
|
|
10
10
|
cadwyn/exceptions.py,sha256=8D1G7ewLrMF5jq7leald1g0ulcH9zQl8ufEK3b7HHAE,1749
|
|
@@ -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.3.dist-info/METADATA,sha256=N67ZpIucrREtYB2WUmWvRf0yG0Fowcj2B_5JTkEElEI,5076
|
|
28
|
+
cadwyn-5.4.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
cadwyn-5.4.3.dist-info/entry_points.txt,sha256=mGX8wl-Xfhpr5M93SUmkykaqinUaYAvW9rtDSX54gx0,47
|
|
30
|
+
cadwyn-5.4.3.dist-info/licenses/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
|
|
31
|
+
cadwyn-5.4.3.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|