cadwyn 5.3.0__tar.gz → 5.3.2__tar.gz
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-5.3.0 → cadwyn-5.3.2}/CHANGELOG.md +12 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/PKG-INFO +2 -2
- {cadwyn-5.3.0 → cadwyn-5.3.2}/README.md +1 -1
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/schema_generation.py +9 -1
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/versions.py +7 -3
- {cadwyn-5.3.0 → cadwyn-5.3.2}/pyproject.toml +2 -1
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_router_generation.py +28 -1
- {cadwyn-5.3.0 → cadwyn-5.3.2}/uv.lock +16 -1
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/CODE_OF_CONDUCT.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/actions/setup-python-uv/action.yaml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/workflows/ci.yaml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/workflows/daily_tests.yaml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/workflows/publish_docs.yaml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.github/workflows/release.yaml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.gitignore +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/.pre-commit-config.yaml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/LICENSE +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/Makefile +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/__main__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/_asts.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/_importer.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/_internal/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/_internal/context_vars.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/_render.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/_utils.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/applications.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/changelogs.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/dependencies.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/exceptions.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/middleware.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/py.typed +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/route_generation.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/routing.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/static/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/static/docs.html +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/common.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/data.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/endpoints.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/enums.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/cadwyn/structure/schemas.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/CNAME +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/api_version_parameter.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/beware_of_data_versioning.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/changelogs.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/cli.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/endpoint_migrations.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/enum_migrations.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/index.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/main_app.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/methodology.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/schema_generation.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/schema_migrations.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/testing.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/concepts/version_changes.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/home/CONTRIBUTING.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_business_logic/index.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_endpoints/index.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/add_field.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/change_field_type.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/change_schema_without_endpoint.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/changing_constraints.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/remove_field.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/rename_a_field_in_schema.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/index.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/version_with_paths_and_numbers_instead_of_headers_and_dates.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/img/dashboard_with_one_version.png +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/img/dashboard_with_two_versions.png +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/img/get_users_endpoint_from_prior_version.png +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/img/simplified_migration_model.png +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/img/sponsor_logos/monite.png +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/img/unversioned_dashboard.png +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/index.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/plugin.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/quickstart/setup.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/quickstart/tutorial.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/theory/how_to_build_versioning_framework.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/theory/how_we_got_here.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs/theory/literature.md +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/block001.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/block002.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/test_block001.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/test_block002.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/block001.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/tests/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/tests/test_block_001.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/setup/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/setup/block001.sh +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/setup/block002.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/setup/tests/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/setup/tests/test_block002.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/block001.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/block002.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/block003.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/tests/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/tests/test_block001.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/tests/test_block002.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/quickstart/tutorial/tests/test_block003.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/docs_src/ruff.toml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/mkdocs.yml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/ruff.toml +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/scripts/fix_links.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/scripts/split_md.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_data/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_data/unversioned_schema_dir/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_data/unversioned_schema_dir/unversioned_schemas.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_data/unversioned_schemas.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/app_for_testing_routing.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/render/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/render/classes.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/render/complex/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/render/complex/classes.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/render/complex/versions.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/render/versions.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/utils.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/versioned_app/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/versioned_app/app.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/versioned_app/v2021_01_01.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/versioned_app/v2022_01_02.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/_resources/versioned_app/webhooks.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/conftest.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_applications.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_auth_dependencies.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_changelog.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_cli.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_data_migrations.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_render.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_router_generation_with_from_future_annotations.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_routing.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/test_enum.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/test_schema.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/test_schema_field.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/test_schema_validator.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/test_schema_with_future_annotations.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_structure.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/tutorial/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/tutorial/main.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/tutorial/test_example.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/versioning_styles/__init__.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tests/versioning_styles/test_versioning_formats.py +0 -0
- {cadwyn-5.3.0 → cadwyn-5.3.2}/tox.ini +0 -0
|
@@ -5,6 +5,18 @@ Please follow [the Keep a Changelog standard](https://keepachangelog.com/en/1.0.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [5.3.2]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
* Add support for `pydantic_settings.BaseSettings` in dependencies
|
|
13
|
+
|
|
14
|
+
## [5.3.1]
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* Fix invalid content-length header with custom exception handlers (#273)
|
|
19
|
+
|
|
8
20
|
## [5.3.0]
|
|
9
21
|
|
|
10
22
|
### Added
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 5.3.
|
|
3
|
+
Version: 5.3.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
|
|
@@ -71,7 +71,7 @@ Production-ready community-driven modern [Stripe-like](https://stripe.com/blog/a
|
|
|
71
71
|
|
|
72
72
|
## Who is this for?
|
|
73
73
|
|
|
74
|
-
Cadwyn allows you to
|
|
74
|
+
Cadwyn allows you to maintain the implementation just for your newest API version and get all the older versions generated automatically. You keep API versioning encapsulated in small and independent "version change" modules while your business logic stays simple and knows nothing about versioning.
|
|
75
75
|
|
|
76
76
|
Its [approach](https://docs.cadwyn.dev/theory/how_we_got_here/#ii-migration-based-response-building) will be useful if you want to:
|
|
77
77
|
|
|
@@ -24,7 +24,7 @@ Production-ready community-driven modern [Stripe-like](https://stripe.com/blog/a
|
|
|
24
24
|
|
|
25
25
|
## Who is this for?
|
|
26
26
|
|
|
27
|
-
Cadwyn allows you to
|
|
27
|
+
Cadwyn allows you to maintain the implementation just for your newest API version and get all the older versions generated automatically. You keep API versioning encapsulated in small and independent "version change" modules while your business logic stays simple and knows nothing about versioning.
|
|
28
28
|
|
|
29
29
|
Its [approach](https://docs.cadwyn.dev/theory/how_we_got_here/#ii-migration-based-response-building) will be useful if you want to:
|
|
30
30
|
|
|
@@ -102,6 +102,14 @@ PYDANTIC_DECORATOR_TYPE_TO_DECORATOR_MAP = {
|
|
|
102
102
|
ComputedFieldInfo: pydantic.computed_field,
|
|
103
103
|
}
|
|
104
104
|
_PYDANTIC_ALL_EXPORTED_NAMES = set(pydantic.__all__)
|
|
105
|
+
_DEFAULT_PYDANTIC_CLASSES = (BaseModel, RootModel)
|
|
106
|
+
|
|
107
|
+
try:
|
|
108
|
+
from pydantic_settings import BaseSettings
|
|
109
|
+
|
|
110
|
+
_DEFAULT_PYDANTIC_CLASSES = (*_DEFAULT_PYDANTIC_CLASSES, BaseSettings)
|
|
111
|
+
except ImportError: # pragma: no cover
|
|
112
|
+
pass
|
|
105
113
|
|
|
106
114
|
|
|
107
115
|
VALIDATOR_CONFIG_KEY = "__validators__"
|
|
@@ -757,7 +765,7 @@ class SchemaGenerator:
|
|
|
757
765
|
if (
|
|
758
766
|
not isinstance(model, type)
|
|
759
767
|
or not lenient_issubclass(model, (BaseModel, Enum))
|
|
760
|
-
or model in
|
|
768
|
+
or model in _DEFAULT_PYDANTIC_CLASSES
|
|
761
769
|
):
|
|
762
770
|
return model
|
|
763
771
|
model = _unwrap_model(model)
|
|
@@ -528,6 +528,8 @@ class VersionBundle:
|
|
|
528
528
|
status_code=raised_exception.status_code,
|
|
529
529
|
headers=raised_exception.headers,
|
|
530
530
|
)
|
|
531
|
+
if (raised_exception.headers or {}).get("content-length") is None: # pragma: no branch
|
|
532
|
+
del response_or_response_body.headers["content-length"]
|
|
531
533
|
api_version = self.api_version_var.get()
|
|
532
534
|
if api_version is None:
|
|
533
535
|
return response_or_response_body
|
|
@@ -579,6 +581,7 @@ class VersionBundle:
|
|
|
579
581
|
head_route.response_model,
|
|
580
582
|
head_route,
|
|
581
583
|
)
|
|
584
|
+
|
|
582
585
|
if isinstance(response_or_response_body, FastapiResponse):
|
|
583
586
|
# a webserver (uvicorn for instance) calculates the body at the endpoint level.
|
|
584
587
|
# if an endpoint returns no "body", its content-length will be set to 0
|
|
@@ -605,9 +608,10 @@ class VersionBundle:
|
|
|
605
608
|
indent=None,
|
|
606
609
|
separators=(",", ":"),
|
|
607
610
|
).encode("utf-8")
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
+
if response_info.headers.get("content-length") is not None:
|
|
612
|
+
# It makes sense to re-calculate content length because the previously calculated one
|
|
613
|
+
# might slightly differ. If it differs -- uvicorn will break.
|
|
614
|
+
response_info.headers["content-length"] = str(len(response_info._response.body))
|
|
611
615
|
|
|
612
616
|
if raised_exception is not None and response_info.status_code >= 400:
|
|
613
617
|
if isinstance(response_info.body, dict) and "detail" in response_info.body:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cadwyn"
|
|
3
|
-
version = "5.3.
|
|
3
|
+
version = "5.3.2"
|
|
4
4
|
description = "Production-ready community-driven modern Stripe-like API versioning in FastAPI"
|
|
5
5
|
authors = [{ name = "Stanislav Zmiev", email = "zmievsa@gmail.com" }]
|
|
6
6
|
license = "MIT"
|
|
@@ -88,6 +88,7 @@ dev-dependencies = [
|
|
|
88
88
|
"pdbpp>=0.10.3",
|
|
89
89
|
"markdown-include-variants>=0.0.4",
|
|
90
90
|
"inline-snapshot>=0.20.7",
|
|
91
|
+
"pydantic-settings>=2.8.1",
|
|
91
92
|
]
|
|
92
93
|
|
|
93
94
|
[project.urls]
|
|
@@ -14,7 +14,8 @@ from fastapi.security import HTTPAuthorizationCredentials, HTTPBearer
|
|
|
14
14
|
from fastapi.security.http import HTTPBasic
|
|
15
15
|
from fastapi.testclient import TestClient
|
|
16
16
|
from inline_snapshot import snapshot
|
|
17
|
-
from pydantic import BaseModel, JsonValue
|
|
17
|
+
from pydantic import BaseModel, Field, JsonValue
|
|
18
|
+
from pydantic_settings import BaseSettings
|
|
18
19
|
from pytest_fixture_classes import fixture_class
|
|
19
20
|
from starlette.responses import FileResponse
|
|
20
21
|
from typing_extensions import Any, NewType, TypeAlias, TypeAliasType, get_args
|
|
@@ -1355,6 +1356,32 @@ def test__router_generation__with_generator_dependencies(
|
|
|
1355
1356
|
)
|
|
1356
1357
|
|
|
1357
1358
|
|
|
1359
|
+
def test__router_generation__with_pydantic_settings_dependency(
|
|
1360
|
+
create_versioned_app: CreateVersionedApp,
|
|
1361
|
+
router: VersionedAPIRouter,
|
|
1362
|
+
) -> None:
|
|
1363
|
+
class Settings(BaseSettings):
|
|
1364
|
+
foo: str = Field(default="bar")
|
|
1365
|
+
|
|
1366
|
+
async def settings() -> Settings:
|
|
1367
|
+
return Settings()
|
|
1368
|
+
|
|
1369
|
+
@router.get("/test")
|
|
1370
|
+
def read_root(settings: Annotated[Settings, Depends(settings)]):
|
|
1371
|
+
assert settings
|
|
1372
|
+
return {"foo": settings.foo}
|
|
1373
|
+
|
|
1374
|
+
app = create_versioned_app(version_change())
|
|
1375
|
+
with TestClient(app) as client:
|
|
1376
|
+
resp = client.get("/test", headers={"x-api-version": "2000-01-01"})
|
|
1377
|
+
assert resp.status_code == 200
|
|
1378
|
+
assert resp.json() == {"foo": "bar"}
|
|
1379
|
+
|
|
1380
|
+
resp = client.get("/test", headers={"x-api-version": "2001-01-01"})
|
|
1381
|
+
assert resp.status_code == 200
|
|
1382
|
+
assert resp.json() == {"foo": "bar"}
|
|
1383
|
+
|
|
1384
|
+
|
|
1358
1385
|
######################
|
|
1359
1386
|
# External lib testing
|
|
1360
1387
|
######################
|
|
@@ -94,7 +94,7 @@ wheels = [
|
|
|
94
94
|
|
|
95
95
|
[[package]]
|
|
96
96
|
name = "cadwyn"
|
|
97
|
-
version = "5.3.
|
|
97
|
+
version = "5.3.2"
|
|
98
98
|
source = { editable = "." }
|
|
99
99
|
dependencies = [
|
|
100
100
|
{ name = "backports-strenum", marker = "python_full_version < '3.11'" },
|
|
@@ -124,6 +124,7 @@ dev = [
|
|
|
124
124
|
{ name = "mkdocs-material" },
|
|
125
125
|
{ name = "mkdocs-simple-hooks" },
|
|
126
126
|
{ name = "pdbpp" },
|
|
127
|
+
{ name = "pydantic-settings" },
|
|
127
128
|
{ name = "pyright" },
|
|
128
129
|
{ name = "pytest" },
|
|
129
130
|
{ name = "pytest-cov" },
|
|
@@ -160,6 +161,7 @@ dev = [
|
|
|
160
161
|
{ name = "mkdocs-material", specifier = ">=9.3.1" },
|
|
161
162
|
{ name = "mkdocs-simple-hooks", specifier = ">=0.1.5" },
|
|
162
163
|
{ name = "pdbpp", specifier = ">=0.10.3" },
|
|
164
|
+
{ name = "pydantic-settings", specifier = ">=2.8.1" },
|
|
163
165
|
{ name = "pyright", specifier = ">=1.1.390" },
|
|
164
166
|
{ name = "pytest", specifier = "==8.3.4" },
|
|
165
167
|
{ name = "pytest-cov", specifier = ">=4.0.0" },
|
|
@@ -1041,6 +1043,19 @@ wheels = [
|
|
|
1041
1043
|
{ url = "https://files.pythonhosted.org/packages/a1/0c/c5c5cd3689c32ed1fe8c5d234b079c12c281c051759770c05b8bed6412b5/pydantic_core-2.27.2-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7d0c8399fcc1848491f00e0314bd59fb34a9c008761bcb422a057670c3f65e35", size = 2004961 },
|
|
1042
1044
|
]
|
|
1043
1045
|
|
|
1046
|
+
[[package]]
|
|
1047
|
+
name = "pydantic-settings"
|
|
1048
|
+
version = "2.8.1"
|
|
1049
|
+
source = { registry = "https://pypi.org/simple" }
|
|
1050
|
+
dependencies = [
|
|
1051
|
+
{ name = "pydantic" },
|
|
1052
|
+
{ name = "python-dotenv" },
|
|
1053
|
+
]
|
|
1054
|
+
sdist = { url = "https://files.pythonhosted.org/packages/88/82/c79424d7d8c29b994fb01d277da57b0a9b09cc03c3ff875f9bd8a86b2145/pydantic_settings-2.8.1.tar.gz", hash = "sha256:d5c663dfbe9db9d5e1c646b2e161da12f0d734d422ee56f567d0ea2cee4e8585", size = 83550 }
|
|
1055
|
+
wheels = [
|
|
1056
|
+
{ url = "https://files.pythonhosted.org/packages/0b/53/a64f03044927dc47aafe029c42a5b7aabc38dfb813475e0e1bf71c4a59d0/pydantic_settings-2.8.1-py3-none-any.whl", hash = "sha256:81942d5ac3d905f7f3ee1a70df5dfb62d5569c12f51a5a647defc1c3d9ee2e9c", size = 30839 },
|
|
1057
|
+
]
|
|
1058
|
+
|
|
1044
1059
|
[[package]]
|
|
1045
1060
|
name = "pygments"
|
|
1046
1061
|
version = "2.19.1"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/change_schema_without_endpoint.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cadwyn-5.3.0 → cadwyn-5.3.2}/docs/how_to/change_openapi_schemas/rename_a_field_in_schema.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cadwyn-5.3.0 → cadwyn-5.3.2}/tests/test_schema_generation/test_schema_with_future_annotations.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|