cadwyn 4.4.5__py3-none-any.whl → 4.5.0__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/route_generation.py +7 -0
- cadwyn/schema_generation.py +1 -1
- cadwyn/structure/data.py +17 -5
- {cadwyn-4.4.5.dist-info → cadwyn-4.5.0.dist-info}/METADATA +1 -1
- {cadwyn-4.4.5.dist-info → cadwyn-4.5.0.dist-info}/RECORD +8 -8
- {cadwyn-4.4.5.dist-info → cadwyn-4.5.0.dist-info}/WHEEL +0 -0
- {cadwyn-4.4.5.dist-info → cadwyn-4.5.0.dist-info}/entry_points.txt +0 -0
- {cadwyn-4.4.5.dist-info → cadwyn-4.5.0.dist-info}/licenses/LICENSE +0 -0
cadwyn/route_generation.py
CHANGED
|
@@ -221,6 +221,8 @@ class _EndpointTransformer(Generic[_R, _WR]):
|
|
|
221
221
|
|
|
222
222
|
for by_schema_converters in version_change.alter_request_by_schema_instructions.values():
|
|
223
223
|
for by_schema_converter in by_schema_converters:
|
|
224
|
+
if not by_schema_converter.check_usage: # pragma: no cover
|
|
225
|
+
continue
|
|
224
226
|
missing_models = set(by_schema_converter.schemas) - head_request_bodies
|
|
225
227
|
if missing_models:
|
|
226
228
|
raise RouteRequestBySchemaConverterDoesNotApplyToAnythingError(
|
|
@@ -232,6 +234,8 @@ class _EndpointTransformer(Generic[_R, _WR]):
|
|
|
232
234
|
)
|
|
233
235
|
for by_schema_converters in version_change.alter_response_by_schema_instructions.values():
|
|
234
236
|
for by_schema_converter in by_schema_converters:
|
|
237
|
+
if not by_schema_converter.check_usage: # pragma: no cover
|
|
238
|
+
continue
|
|
235
239
|
missing_models = set(by_schema_converter.schemas) - head_response_models
|
|
236
240
|
if missing_models:
|
|
237
241
|
raise RouteResponseBySchemaConverterDoesNotApplyToAnythingError(
|
|
@@ -240,6 +244,9 @@ class _EndpointTransformer(Generic[_R, _WR]):
|
|
|
240
244
|
f"failed to find routes with the following response models: "
|
|
241
245
|
f"{[m.__name__ for m in missing_models]}. "
|
|
242
246
|
f"This means that you are trying to apply this converter to non-existing endpoint(s). "
|
|
247
|
+
"If this is intentional and this converter really does not apply to any endpoints, then "
|
|
248
|
+
"pass check_usage=False argument to "
|
|
249
|
+
f"{version_change.__name__}.{by_schema_converter.transformer.__name__}"
|
|
243
250
|
)
|
|
244
251
|
|
|
245
252
|
def _extract_all_routes_identifiers(
|
cadwyn/schema_generation.py
CHANGED
cadwyn/structure/data.py
CHANGED
|
@@ -86,6 +86,12 @@ class _AlterDataInstruction:
|
|
|
86
86
|
return self.transformer(__request_or_response)
|
|
87
87
|
|
|
88
88
|
|
|
89
|
+
@dataclass
|
|
90
|
+
class _BaseAlterBySchemaInstruction:
|
|
91
|
+
schemas: tuple[Any, ...]
|
|
92
|
+
check_usage: bool = True
|
|
93
|
+
|
|
94
|
+
|
|
89
95
|
##########
|
|
90
96
|
# Requests
|
|
91
97
|
##########
|
|
@@ -97,8 +103,7 @@ class _BaseAlterRequestInstruction(_AlterDataInstruction):
|
|
|
97
103
|
|
|
98
104
|
|
|
99
105
|
@dataclass
|
|
100
|
-
class _AlterRequestBySchemaInstruction(_BaseAlterRequestInstruction):
|
|
101
|
-
schemas: tuple[Any, ...]
|
|
106
|
+
class _AlterRequestBySchemaInstruction(_BaseAlterBySchemaInstruction, _BaseAlterRequestInstruction): ...
|
|
102
107
|
|
|
103
108
|
|
|
104
109
|
@dataclass
|
|
@@ -110,7 +115,10 @@ class _AlterRequestByPathInstruction(_BaseAlterRequestInstruction):
|
|
|
110
115
|
|
|
111
116
|
@overload
|
|
112
117
|
def convert_request_to_next_version_for(
|
|
113
|
-
first_schema: type,
|
|
118
|
+
first_schema: type,
|
|
119
|
+
/,
|
|
120
|
+
*additional_schemas: type,
|
|
121
|
+
check_usage: bool = True,
|
|
114
122
|
) -> "type[staticmethod[_P, None]]": ...
|
|
115
123
|
|
|
116
124
|
|
|
@@ -123,6 +131,7 @@ def convert_request_to_next_version_for(
|
|
|
123
131
|
methods_or_second_schema: list[str] | None | type = None,
|
|
124
132
|
/,
|
|
125
133
|
*additional_schemas: type,
|
|
134
|
+
check_usage: bool = True,
|
|
126
135
|
) -> "type[staticmethod[_P, None]]":
|
|
127
136
|
_validate_decorator_args(schema_or_path, methods_or_second_schema, additional_schemas)
|
|
128
137
|
|
|
@@ -141,6 +150,7 @@ def convert_request_to_next_version_for(
|
|
|
141
150
|
return _AlterRequestBySchemaInstruction(
|
|
142
151
|
schemas=schemas,
|
|
143
152
|
transformer=transformer,
|
|
153
|
+
check_usage=check_usage,
|
|
144
154
|
)
|
|
145
155
|
|
|
146
156
|
return decorator # pyright: ignore[reportReturnType]
|
|
@@ -158,8 +168,7 @@ class _BaseAlterResponseInstruction(_AlterDataInstruction):
|
|
|
158
168
|
|
|
159
169
|
|
|
160
170
|
@dataclass
|
|
161
|
-
class _AlterResponseBySchemaInstruction(_BaseAlterResponseInstruction):
|
|
162
|
-
schemas: tuple[Any, ...]
|
|
171
|
+
class _AlterResponseBySchemaInstruction(_BaseAlterBySchemaInstruction, _BaseAlterResponseInstruction): ...
|
|
163
172
|
|
|
164
173
|
|
|
165
174
|
@dataclass
|
|
@@ -175,6 +184,7 @@ def convert_response_to_previous_version_for(
|
|
|
175
184
|
/,
|
|
176
185
|
*schemas: type,
|
|
177
186
|
migrate_http_errors: bool = False,
|
|
187
|
+
check_usage: bool = True,
|
|
178
188
|
) -> "type[staticmethod[_P, None]]": ...
|
|
179
189
|
|
|
180
190
|
|
|
@@ -194,6 +204,7 @@ def convert_response_to_previous_version_for(
|
|
|
194
204
|
/,
|
|
195
205
|
*additional_schemas: type,
|
|
196
206
|
migrate_http_errors: bool = False,
|
|
207
|
+
check_usage: bool = True,
|
|
197
208
|
) -> "type[staticmethod[_P, None]]":
|
|
198
209
|
_validate_decorator_args(schema_or_path, methods_or_second_schema, additional_schemas)
|
|
199
210
|
|
|
@@ -215,6 +226,7 @@ def convert_response_to_previous_version_for(
|
|
|
215
226
|
schemas=schemas,
|
|
216
227
|
transformer=transformer,
|
|
217
228
|
migrate_http_errors=migrate_http_errors,
|
|
229
|
+
check_usage=check_usage,
|
|
218
230
|
)
|
|
219
231
|
|
|
220
232
|
return decorator # pyright: ignore[reportReturnType]
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.5.0
|
|
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
|
|
@@ -9,20 +9,20 @@ cadwyn/changelogs.py,sha256=uveMizeeqNv0JuXza9Rkg0ulDEWyJL24bRxcHkHlwjI,20054
|
|
|
9
9
|
cadwyn/exceptions.py,sha256=VlJKRmEGfFTDtHbOWc8kXK4yMi2N172K684Y2UIV8rI,1832
|
|
10
10
|
cadwyn/middleware.py,sha256=kUZK2dmoricMbv6knPCIHpXEInX2670XIwAj0v_XQxk,3408
|
|
11
11
|
cadwyn/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
12
|
-
cadwyn/route_generation.py,sha256=
|
|
12
|
+
cadwyn/route_generation.py,sha256=tdIsdDIBY4hVUlTGMh4pTMM92LzxhV9CmGs6J8iAhaw,25152
|
|
13
13
|
cadwyn/routing.py,sha256=mZRe7ivfTY2qdgrCBO4AHvKQq6Dazf7g_8B6aCrTgN8,7221
|
|
14
|
-
cadwyn/schema_generation.py,sha256=
|
|
14
|
+
cadwyn/schema_generation.py,sha256=OUOcBfIDFviSqIYy0a2EHVWWSh1n2GKbvtr5xuolFgQ,40750
|
|
15
15
|
cadwyn/static/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
16
16
|
cadwyn/static/docs.html,sha256=WNm5ANJVy51TcIUFOaqKf1Z8eF86CC85TTHPxACtkzw,3455
|
|
17
17
|
cadwyn/structure/__init__.py,sha256=Wgvjdq3vfl9Yhe-BkcFGAMi_Co11YOfTmJQqgF5Gzx4,655
|
|
18
18
|
cadwyn/structure/common.py,sha256=GUclfxKLRlFwPjT237fCtLIzdvjvC9gI3acuxBizwbg,414
|
|
19
|
-
cadwyn/structure/data.py,sha256=
|
|
19
|
+
cadwyn/structure/data.py,sha256=uViRW4uOOonXZj90hOlPNk02AIwp0fvDNoF8M5_CEes,7707
|
|
20
20
|
cadwyn/structure/endpoints.py,sha256=8lrc4xanCt7gat106yYRIQC0TNxzFkLF-urIml_d_X0,5934
|
|
21
21
|
cadwyn/structure/enums.py,sha256=bZL-iUOUFi9ZYlMZJw-tAix2yrgCp3gH3N2gwO44LUU,1043
|
|
22
22
|
cadwyn/structure/schemas.py,sha256=bck4XzCOICVuohh-ZpIv4l57hx3l-f0O23b7w8n2WvA,8215
|
|
23
23
|
cadwyn/structure/versions.py,sha256=L07vdC9d7_h4WKV8TArgZKfgfzB8-M4f62FXZm8o1TM,33232
|
|
24
|
-
cadwyn-4.
|
|
25
|
-
cadwyn-4.
|
|
26
|
-
cadwyn-4.
|
|
27
|
-
cadwyn-4.
|
|
28
|
-
cadwyn-4.
|
|
24
|
+
cadwyn-4.5.0.dist-info/METADATA,sha256=7V9B9KEfVWvWZPDZBCNLgGYMRqvJ1w2-bX69O9z8xmY,4504
|
|
25
|
+
cadwyn-4.5.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
26
|
+
cadwyn-4.5.0.dist-info/entry_points.txt,sha256=mGX8wl-Xfhpr5M93SUmkykaqinUaYAvW9rtDSX54gx0,47
|
|
27
|
+
cadwyn-4.5.0.dist-info/licenses/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
|
|
28
|
+
cadwyn-4.5.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|