cadwyn 5.4.5__py3-none-any.whl → 5.6.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/changelogs.py +19 -17
- cadwyn/structure/schemas.py +4 -0
- {cadwyn-5.4.5.dist-info → cadwyn-5.6.0.dist-info}/METADATA +3 -3
- {cadwyn-5.4.5.dist-info → cadwyn-5.6.0.dist-info}/RECORD +7 -7
- {cadwyn-5.4.5.dist-info → cadwyn-5.6.0.dist-info}/WHEEL +0 -0
- {cadwyn-5.4.5.dist-info → cadwyn-5.6.0.dist-info}/entry_points.txt +0 -0
- {cadwyn-5.4.5.dist-info → cadwyn-5.6.0.dist-info}/licenses/LICENSE +0 -0
cadwyn/changelogs.py
CHANGED
|
@@ -2,9 +2,13 @@ import copy
|
|
|
2
2
|
import sys
|
|
3
3
|
from enum import auto
|
|
4
4
|
from logging import getLogger
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import Any, Literal, TypeVar, Union, cast, get_args
|
|
6
6
|
|
|
7
|
-
from fastapi.
|
|
7
|
+
from fastapi._compat import (
|
|
8
|
+
get_compat_model_name_map,
|
|
9
|
+
get_definitions,
|
|
10
|
+
)
|
|
11
|
+
from fastapi._compat.v2 import ModelField
|
|
8
12
|
from fastapi.openapi.utils import (
|
|
9
13
|
get_fields_from_routes,
|
|
10
14
|
get_openapi,
|
|
@@ -35,9 +39,6 @@ from .structure.schemas import (
|
|
|
35
39
|
ValidatorExistedInstruction,
|
|
36
40
|
)
|
|
37
41
|
|
|
38
|
-
if TYPE_CHECKING:
|
|
39
|
-
from fastapi._compat import ModelField
|
|
40
|
-
|
|
41
42
|
if sys.version_info >= (3, 11): # pragma: no cover
|
|
42
43
|
from enum import StrEnum
|
|
43
44
|
else: # pragma: no cover
|
|
@@ -89,7 +90,7 @@ def _generate_changelog(versions: VersionBundle, router: _RootCadwynAPIRouter) -
|
|
|
89
90
|
version_change,
|
|
90
91
|
generator_from_newer_version,
|
|
91
92
|
generator_from_older_version,
|
|
92
|
-
schemas_from_older_version,
|
|
93
|
+
schemas_from_older_version, # pyright: ignore[reportArgumentType]
|
|
93
94
|
cast("list[APIRoute]", routes_from_newer_version),
|
|
94
95
|
)
|
|
95
96
|
if changelog_entry is not None: # pragma: no branch # This should never happen
|
|
@@ -153,21 +154,22 @@ def _get_all_pydantic_models_from_generic(annotation: Any) -> list[type[BaseMode
|
|
|
153
154
|
|
|
154
155
|
|
|
155
156
|
def _get_openapi_representation_of_a_field(model: type[BaseModel], field_name: str) -> dict:
|
|
156
|
-
from fastapi._compat import (
|
|
157
|
-
GenerateJsonSchema,
|
|
158
|
-
ModelField,
|
|
159
|
-
get_compat_model_name_map,
|
|
160
|
-
get_definitions,
|
|
161
|
-
)
|
|
162
|
-
|
|
163
157
|
class CadwynDummyModelForRepresentation(BaseModel):
|
|
164
158
|
my_field: model
|
|
165
159
|
|
|
166
|
-
model_name_map = get_compat_model_name_map(
|
|
167
|
-
|
|
160
|
+
model_name_map = get_compat_model_name_map(
|
|
161
|
+
[
|
|
162
|
+
CadwynDummyModelForRepresentation.model_fields["my_field"], # pyright: ignore[reportArgumentType]
|
|
163
|
+
]
|
|
164
|
+
)
|
|
165
|
+
|
|
168
166
|
_, definitions = get_definitions(
|
|
169
|
-
fields=[
|
|
170
|
-
|
|
167
|
+
fields=[
|
|
168
|
+
ModelField(
|
|
169
|
+
CadwynDummyModelForRepresentation.model_fields["my_field"],
|
|
170
|
+
"my_field",
|
|
171
|
+
), # pyright: ignore[reportArgumentType]
|
|
172
|
+
],
|
|
171
173
|
model_name_map=model_name_map,
|
|
172
174
|
separate_input_output_schemas=False,
|
|
173
175
|
)
|
cadwyn/structure/schemas.py
CHANGED
|
@@ -58,6 +58,7 @@ PossibleFieldAttributes = Literal[
|
|
|
58
58
|
"allow_mutation",
|
|
59
59
|
"pattern",
|
|
60
60
|
"discriminator",
|
|
61
|
+
"json_schema_extra",
|
|
61
62
|
]
|
|
62
63
|
|
|
63
64
|
|
|
@@ -100,6 +101,7 @@ class FieldChanges:
|
|
|
100
101
|
allow_mutation: bool
|
|
101
102
|
pattern: str
|
|
102
103
|
discriminator: str
|
|
104
|
+
json_schema_extra: Union[dict[str, Any], Callable[[dict[str, Any]], None], None]
|
|
103
105
|
|
|
104
106
|
|
|
105
107
|
@dataclass(**DATACLASS_SLOTS)
|
|
@@ -178,6 +180,7 @@ class AlterFieldInstructionFactory:
|
|
|
178
180
|
allow_mutation: bool = Sentinel,
|
|
179
181
|
pattern: str = Sentinel,
|
|
180
182
|
discriminator: str = Sentinel,
|
|
183
|
+
json_schema_extra: Union[dict[str, Any], Callable[[dict[str, Any]], None], None] = Sentinel,
|
|
181
184
|
) -> FieldHadInstruction:
|
|
182
185
|
return FieldHadInstruction(
|
|
183
186
|
is_hidden_from_changelog=False,
|
|
@@ -222,6 +225,7 @@ class AlterFieldInstructionFactory:
|
|
|
222
225
|
allow_mutation=allow_mutation,
|
|
223
226
|
pattern=pattern,
|
|
224
227
|
discriminator=discriminator,
|
|
228
|
+
json_schema_extra=json_schema_extra,
|
|
225
229
|
),
|
|
226
230
|
)
|
|
227
231
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.6.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
|
|
@@ -35,14 +35,14 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
35
35
|
Classifier: Typing :: Typed
|
|
36
36
|
Requires-Python: >=3.9
|
|
37
37
|
Requires-Dist: backports-strenum<2,>=1.3.1; python_version < '3.11'
|
|
38
|
-
Requires-Dist: fastapi>=0.
|
|
38
|
+
Requires-Dist: fastapi>=0.119.0
|
|
39
39
|
Requires-Dist: jinja2>=3.1.2
|
|
40
40
|
Requires-Dist: pydantic>=2.11.0
|
|
41
41
|
Requires-Dist: starlette>=0.30.0
|
|
42
42
|
Requires-Dist: typing-extensions>=4.8.0
|
|
43
43
|
Requires-Dist: typing-inspection>=0.4.0
|
|
44
44
|
Provides-Extra: standard
|
|
45
|
-
Requires-Dist: fastapi[standard]>=0.
|
|
45
|
+
Requires-Dist: fastapi[standard]>=0.119.0; extra == 'standard'
|
|
46
46
|
Requires-Dist: typer>=0.7.0; extra == 'standard'
|
|
47
47
|
Description-Content-Type: text/markdown
|
|
48
48
|
|
|
@@ -5,7 +5,7 @@ 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
7
|
cadwyn/applications.py,sha256=FALDl4v_8dJWdrpHEuvG34C_vfnKKh01rAOiyg5wVak,21200
|
|
8
|
-
cadwyn/changelogs.py,sha256=
|
|
8
|
+
cadwyn/changelogs.py,sha256=cie376hLvGaY4m3sQKPYOQ_McrD1bVD6aQk5swdIaTU,19700
|
|
9
9
|
cadwyn/dependencies.py,sha256=phUJ4Fy3UTegpOfDfHMjxsvASWo-1NQgwqphNnPdoVQ,241
|
|
10
10
|
cadwyn/exceptions.py,sha256=8D1G7ewLrMF5jq7leald1g0ulcH9zQl8ufEK3b7HHAE,1749
|
|
11
11
|
cadwyn/middleware.py,sha256=4Ziq1ysnc8j5KmeZpsr9VJKllEFC8uYwXnG01I2FPR4,4853
|
|
@@ -22,10 +22,10 @@ cadwyn/structure/common.py,sha256=YuyfYMxkJcj2c5SFh9teBoEC2xLO5_2QjPzYjwdZcTs,47
|
|
|
22
22
|
cadwyn/structure/data.py,sha256=eb4HlGTu3V_G5vJuQ4GLEaGd4LmPmFX3L8CXwJKzfOE,7795
|
|
23
23
|
cadwyn/structure/endpoints.py,sha256=OYNaZ76VidtSutQfteFMba5nNIXtEjwCAvgpy3fRBT4,6246
|
|
24
24
|
cadwyn/structure/enums.py,sha256=4FCc9aniLE3VuWAVIacrNP_FWxTIUm9JkeeHA_zZdwQ,1254
|
|
25
|
-
cadwyn/structure/schemas.py,sha256=
|
|
25
|
+
cadwyn/structure/schemas.py,sha256=qQB9kSIpq1O_3-CWSKv80ti6unTqSMnisXWBffPrmUA,11049
|
|
26
26
|
cadwyn/structure/versions.py,sha256=3ZDKewBHHWmAwhOQbIR5p17ANzqglMDTvYUGKTAqXyk,34710
|
|
27
|
-
cadwyn-5.
|
|
28
|
-
cadwyn-5.
|
|
29
|
-
cadwyn-5.
|
|
30
|
-
cadwyn-5.
|
|
31
|
-
cadwyn-5.
|
|
27
|
+
cadwyn-5.6.0.dist-info/METADATA,sha256=OZQl9_XaI231EvbevfASNWG2OYbKv7jlzvqqynkaGjY,4504
|
|
28
|
+
cadwyn-5.6.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
29
|
+
cadwyn-5.6.0.dist-info/entry_points.txt,sha256=mGX8wl-Xfhpr5M93SUmkykaqinUaYAvW9rtDSX54gx0,47
|
|
30
|
+
cadwyn-5.6.0.dist-info/licenses/LICENSE,sha256=KeCWewiDQYpmSnzF-p_0YpoWiyDcUPaCuG8OWQs4ig4,1072
|
|
31
|
+
cadwyn-5.6.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|