cadwyn 5.1.3__tar.gz → 5.2.0__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.1.3 → cadwyn-5.2.0}/CHANGELOG.md +12 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/PKG-INFO +1 -2
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/_render.py +1 -1
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/route_generation.py +1 -2
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/schemas.py +1 -1
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/versions.py +8 -6
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/version_changes.md +2 -4
- {cadwyn-5.1.3 → cadwyn-5.2.0}/pyproject.toml +2 -2
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_data_migrations.py +41 -1
- {cadwyn-5.1.3 → cadwyn-5.2.0}/uv.lock +1 -12
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/CODE_OF_CONDUCT.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/actions/setup-python-uv/action.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/workflows/ci.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/workflows/daily_tests.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/workflows/publish_docs.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.github/workflows/release.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.gitignore +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/.pre-commit-config.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/LICENSE +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/Makefile +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/README.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/__main__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/_asts.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/_importer.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/_utils.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/applications.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/changelogs.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/dependencies.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/exceptions.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/middleware.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/py.typed +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/routing.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/schema_generation.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/static/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/static/docs.html +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/common.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/data.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/endpoints.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/cadwyn/structure/enums.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/CNAME +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/api_version_parameter_and_context_variables.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/beware_of_data_versioning.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/changelogs.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/cli.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/endpoint_migrations.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/enum_migrations.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/main_app.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/methodology.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/schema_generation.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/schema_migrations.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/testing.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/concepts/where_to_put_the_version_and_how_to_format_it.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/home/CONTRIBUTING.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_business_logic/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_endpoints/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/add_field.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/change_field_type.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/change_schema_without_endpoint.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/changing_constraints.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/remove_field.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/rename_a_field_in_schema.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/version_with_paths_and_numbers_instead_of_headers_and_dates.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/img/dashboard_with_one_version.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/img/dashboard_with_two_versions.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/img/get_users_endpoint_from_prior_version.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/img/simplified_migration_model.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/img/sponsor_logos/monite.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/img/unversioned_dashboard.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/plugin.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/quickstart/setup.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/quickstart/tutorial.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/theory/how_to_build_versioning_framework.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/theory/how_we_got_here.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs/theory/literature.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/test_block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/test_block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/tests/test_block_001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/setup/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/setup/block001.sh +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/setup/block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/setup/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/setup/tests/test_block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/block003.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/tests/test_block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/tests/test_block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/quickstart/tutorial/tests/test_block003.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/docs_src/ruff.toml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/mkdocs.yml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/ruff.toml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/scripts/fix_links.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/scripts/split_md.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_data/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_data/unversioned_schema_dir/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_data/unversioned_schema_dir/unversioned_schemas.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_data/unversioned_schemas.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/app_for_testing_routing.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/render/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/render/classes.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/render/complex/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/render/complex/classes.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/render/complex/versions.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/render/versions.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/utils.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/versioned_app/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/versioned_app/app.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/versioned_app/v2021_01_01.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/versioned_app/v2022_01_02.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/_resources/versioned_app/webhooks.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/conftest.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_applications.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_auth_dependencies.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_changelog.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_cli.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_render.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_router_generation.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_router_generation_with_from_future_annotations.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_routing.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_schema_generation/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_schema_generation/test_enum.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_schema_generation/test_schema.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_schema_generation/test_schema_field.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_schema_generation/test_schema_validator.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_schema_generation/test_schema_with_future_annotations.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/test_structure.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/tutorial/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/tutorial/main.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/tutorial/test_example.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/versioning_styles/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/tests/versioning_styles/test_versioning_formats.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.2.0}/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.2.0]
|
|
9
|
+
|
|
10
|
+
### Removed
|
|
11
|
+
|
|
12
|
+
* `issubclass` dependency
|
|
13
|
+
|
|
14
|
+
## [5.1.4]
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
|
|
18
|
+
* a bug where a custom HTTP exception was not being copied correctly so its unique properties are ignored
|
|
19
|
+
|
|
8
20
|
## [5.1.3]
|
|
9
21
|
|
|
10
22
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 5.
|
|
3
|
+
Version: 5.2.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
|
|
@@ -36,7 +36,6 @@ Classifier: Typing :: Typed
|
|
|
36
36
|
Requires-Python: >=3.9
|
|
37
37
|
Requires-Dist: backports-strenum<2,>=1.3.1; python_version < '3.11'
|
|
38
38
|
Requires-Dist: fastapi>=0.112.4
|
|
39
|
-
Requires-Dist: issubclass>=0.1.2
|
|
40
39
|
Requires-Dist: jinja2>=3.1.2
|
|
41
40
|
Requires-Dist: pydantic>=2.0.0
|
|
42
41
|
Requires-Dist: starlette>=0.30.0
|
|
@@ -5,10 +5,10 @@ from enum import Enum
|
|
|
5
5
|
from typing import TYPE_CHECKING, Union
|
|
6
6
|
|
|
7
7
|
import typer
|
|
8
|
-
from issubclass import issubclass as lenient_issubclass
|
|
9
8
|
from pydantic import BaseModel
|
|
10
9
|
|
|
11
10
|
from cadwyn._asts import get_fancy_repr, pop_docstring_from_cls_body
|
|
11
|
+
from cadwyn._utils import lenient_issubclass
|
|
12
12
|
from cadwyn.exceptions import CadwynRenderError
|
|
13
13
|
from cadwyn.schema_generation import (
|
|
14
14
|
PydanticFieldWrapper,
|
|
@@ -17,12 +17,11 @@ import fastapi.security.base
|
|
|
17
17
|
import fastapi.utils
|
|
18
18
|
from fastapi import APIRouter
|
|
19
19
|
from fastapi.routing import APIRoute
|
|
20
|
-
from issubclass import issubclass as lenient_issubclass
|
|
21
20
|
from pydantic import BaseModel
|
|
22
21
|
from starlette.routing import BaseRoute
|
|
23
22
|
from typing_extensions import TypeVar, assert_never
|
|
24
23
|
|
|
25
|
-
from cadwyn._utils import DATACLASS_SLOTS, Sentinel
|
|
24
|
+
from cadwyn._utils import DATACLASS_SLOTS, Sentinel, lenient_issubclass
|
|
26
25
|
from cadwyn.exceptions import (
|
|
27
26
|
CadwynError,
|
|
28
27
|
RouteAlreadyExistsError,
|
|
@@ -2,7 +2,6 @@ from collections.abc import Callable
|
|
|
2
2
|
from dataclasses import dataclass
|
|
3
3
|
from typing import TYPE_CHECKING, Any, Literal, Union, cast
|
|
4
4
|
|
|
5
|
-
from issubclass import issubclass as lenient_issubclass
|
|
6
5
|
from pydantic import AliasChoices, AliasPath, BaseModel, Field
|
|
7
6
|
from pydantic._internal._decorators import PydanticDescriptorProxy, unwrap_wrapped_function
|
|
8
7
|
from pydantic.fields import FieldInfo
|
|
@@ -12,6 +11,7 @@ from cadwyn._utils import (
|
|
|
12
11
|
Sentinel,
|
|
13
12
|
fully_unwrap_decorator,
|
|
14
13
|
get_name_of_function_wrapped_in_pydantic_validator,
|
|
14
|
+
lenient_issubclass,
|
|
15
15
|
)
|
|
16
16
|
from cadwyn.exceptions import CadwynStructureError
|
|
17
17
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import email.message
|
|
2
2
|
import functools
|
|
3
|
+
import http
|
|
3
4
|
import inspect
|
|
4
5
|
import json
|
|
5
6
|
from collections import defaultdict
|
|
@@ -8,7 +9,7 @@ from contextlib import AsyncExitStack
|
|
|
8
9
|
from contextvars import ContextVar
|
|
9
10
|
from datetime import date
|
|
10
11
|
from enum import Enum
|
|
11
|
-
from typing import TYPE_CHECKING, ClassVar, Union
|
|
12
|
+
from typing import TYPE_CHECKING, ClassVar, Union, cast
|
|
12
13
|
|
|
13
14
|
from fastapi import BackgroundTasks, HTTPException, params
|
|
14
15
|
from fastapi import Request as FastapiRequest
|
|
@@ -616,12 +617,13 @@ class VersionBundle:
|
|
|
616
617
|
detail = response_info.body["detail"]
|
|
617
618
|
else:
|
|
618
619
|
detail = response_info.body
|
|
620
|
+
if detail is None:
|
|
621
|
+
detail = http.HTTPStatus(response_info.status_code).phrase
|
|
622
|
+
raised_exception.detail = cast(str, detail)
|
|
623
|
+
raised_exception.headers = dict(response_info.headers)
|
|
624
|
+
raised_exception.status_code = response_info.status_code
|
|
619
625
|
|
|
620
|
-
raise
|
|
621
|
-
status_code=response_info.status_code,
|
|
622
|
-
detail=detail,
|
|
623
|
-
headers=dict(response_info.headers),
|
|
624
|
-
)
|
|
626
|
+
raise raised_exception
|
|
625
627
|
return response_info._response
|
|
626
628
|
return response_info.body
|
|
627
629
|
|
|
@@ -39,8 +39,7 @@ from .v2023_02_10 import RemoveTaxIDEndpoints
|
|
|
39
39
|
|
|
40
40
|
versions = VersionBundle(
|
|
41
41
|
HeadVersion(),
|
|
42
|
-
Version("2023-02-10"),
|
|
43
|
-
RemoveTaxIDEndpoints,
|
|
42
|
+
Version("2023-02-10", RemoveTaxIDEndpoints),
|
|
44
43
|
Version("2022-11-16"),
|
|
45
44
|
)
|
|
46
45
|
```
|
|
@@ -64,8 +63,7 @@ from .v2023_02_10 import RemoveTaxIDEndpoints
|
|
|
64
63
|
|
|
65
64
|
versions = VersionBundle(
|
|
66
65
|
HeadVersion(),
|
|
67
|
-
Version("2023-02-10"),
|
|
68
|
-
RemoveTaxIDEndpoints,
|
|
66
|
+
Version("2023-02-10", RemoveTaxIDEndpoints),
|
|
69
67
|
Version("2022-11-16"),
|
|
70
68
|
)
|
|
71
69
|
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "cadwyn"
|
|
3
|
-
version = "5.
|
|
3
|
+
version = "5.2.0"
|
|
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"
|
|
@@ -55,7 +55,6 @@ dependencies = [
|
|
|
55
55
|
"starlette >=0.30.0",
|
|
56
56
|
"pydantic >=2.0.0",
|
|
57
57
|
"jinja2 >=3.1.2",
|
|
58
|
-
"issubclass >=0.1.2",
|
|
59
58
|
"backports-strenum >=1.3.1,<2; python_version < '3.11'",
|
|
60
59
|
"typing-extensions>=4.8.0",
|
|
61
60
|
]
|
|
@@ -154,6 +153,7 @@ reportMissingSuperCall = true
|
|
|
154
153
|
reportFunctionMemberAccess = false
|
|
155
154
|
reportCircularImports = true
|
|
156
155
|
reportInvalidTypeForm = false
|
|
156
|
+
reportPrivateImportUsage = false
|
|
157
157
|
|
|
158
158
|
[tool.pytest.ini_options]
|
|
159
159
|
filterwarnings = [
|
|
@@ -3,7 +3,7 @@ import re
|
|
|
3
3
|
from collections.abc import Callable, Coroutine
|
|
4
4
|
from contextvars import ContextVar
|
|
5
5
|
from io import StringIO
|
|
6
|
-
from typing import Any, Literal, Union
|
|
6
|
+
from typing import Any, Literal, Optional, Union
|
|
7
7
|
|
|
8
8
|
import fastapi
|
|
9
9
|
import pytest
|
|
@@ -11,6 +11,7 @@ from dirty_equals import IsPartialDict, IsStr
|
|
|
11
11
|
from fastapi import APIRouter, Body, Cookie, File, Header, HTTPException, Query, Request, Response, UploadFile
|
|
12
12
|
from fastapi.responses import JSONResponse
|
|
13
13
|
from fastapi.routing import APIRoute
|
|
14
|
+
from fastapi.testclient import TestClient
|
|
14
15
|
from pydantic import BaseModel, Field, RootModel
|
|
15
16
|
from starlette.responses import StreamingResponse
|
|
16
17
|
|
|
@@ -32,6 +33,7 @@ from cadwyn.structure.data import RequestInfo, ResponseInfo
|
|
|
32
33
|
from cadwyn.structure.schemas import schema
|
|
33
34
|
from cadwyn.structure.versions import Version, VersionBundle
|
|
34
35
|
from tests.conftest import (
|
|
36
|
+
CreateVersionedApp,
|
|
35
37
|
CreateVersionedClients,
|
|
36
38
|
client,
|
|
37
39
|
version_change,
|
|
@@ -1226,3 +1228,41 @@ def test__request_and_response_migrations__with_multiple_schemas_in_converters(
|
|
|
1226
1228
|
resp_2001 = client_2001.post(f"/{endpoint}", json={"i": ["original_request"]})
|
|
1227
1229
|
assert resp_2001.status_code == 200
|
|
1228
1230
|
assert resp_2001.json() == {"i": ["original_request", endpoint]}
|
|
1231
|
+
|
|
1232
|
+
|
|
1233
|
+
def test__response_migrations__with_custom_http_exception(
|
|
1234
|
+
create_versioned_app: CreateVersionedApp,
|
|
1235
|
+
router: VersionedAPIRouter,
|
|
1236
|
+
) -> None:
|
|
1237
|
+
class CustomHTTPException(HTTPException):
|
|
1238
|
+
error_code: Optional[str] = None
|
|
1239
|
+
|
|
1240
|
+
def __init__(self, detail: str, error_code: Optional[str] = None):
|
|
1241
|
+
self.error_code = error_code
|
|
1242
|
+
super().__init__(status_code=400, detail=detail)
|
|
1243
|
+
|
|
1244
|
+
def http_exception_handler(request, exc):
|
|
1245
|
+
# Check if the exception has an error_code attribute
|
|
1246
|
+
error_code = exc.error_code if hasattr(exc, "error_code") else "generic_error"
|
|
1247
|
+
|
|
1248
|
+
return JSONResponse(
|
|
1249
|
+
status_code=exc.status_code,
|
|
1250
|
+
content={"code": error_code, "message": exc.detail},
|
|
1251
|
+
)
|
|
1252
|
+
|
|
1253
|
+
# Register exception handler for Cadwyn
|
|
1254
|
+
|
|
1255
|
+
@router.post("/test")
|
|
1256
|
+
async def endpoint():
|
|
1257
|
+
raise CustomHTTPException("Cadwyn error occurred", error_code="cadwyn_error")
|
|
1258
|
+
|
|
1259
|
+
app = create_versioned_app(version_change())
|
|
1260
|
+
app.add_exception_handler(HTTPException, http_exception_handler)
|
|
1261
|
+
with TestClient(app) as client:
|
|
1262
|
+
resp = client.post("/test", headers={"X-API-VERSION": "2000-01-01"})
|
|
1263
|
+
assert resp.status_code == 400
|
|
1264
|
+
assert resp.json() == {"code": "cadwyn_error", "message": "Cadwyn error occurred"}
|
|
1265
|
+
|
|
1266
|
+
resp_2001 = client.post("/test", headers={"X-API-VERSION": "2001-01-01"})
|
|
1267
|
+
assert resp_2001.status_code == 400
|
|
1268
|
+
assert resp_2001.json() == {"code": "cadwyn_error", "message": "Cadwyn error occurred"}
|
|
@@ -94,12 +94,11 @@ wheels = [
|
|
|
94
94
|
|
|
95
95
|
[[package]]
|
|
96
96
|
name = "cadwyn"
|
|
97
|
-
version = "5.
|
|
97
|
+
version = "5.2.0"
|
|
98
98
|
source = { editable = "." }
|
|
99
99
|
dependencies = [
|
|
100
100
|
{ name = "backports-strenum", marker = "python_full_version < '3.11'" },
|
|
101
101
|
{ name = "fastapi" },
|
|
102
|
-
{ name = "issubclass" },
|
|
103
102
|
{ name = "jinja2" },
|
|
104
103
|
{ name = "pydantic" },
|
|
105
104
|
{ name = "starlette" },
|
|
@@ -140,7 +139,6 @@ requires-dist = [
|
|
|
140
139
|
{ name = "backports-strenum", marker = "python_full_version < '3.11'", specifier = ">=1.3.1,<2" },
|
|
141
140
|
{ name = "fastapi", specifier = ">=0.112.4" },
|
|
142
141
|
{ name = "fastapi", extras = ["standard"], marker = "extra == 'standard'", specifier = ">=0.112.3" },
|
|
143
|
-
{ name = "issubclass", specifier = ">=0.1.2" },
|
|
144
142
|
{ name = "jinja2", specifier = ">=3.1.2" },
|
|
145
143
|
{ name = "pydantic", specifier = ">=2.0.0" },
|
|
146
144
|
{ name = "starlette", specifier = ">=0.30.0" },
|
|
@@ -614,15 +612,6 @@ wheels = [
|
|
|
614
612
|
{ url = "https://files.pythonhosted.org/packages/76/74/5222a632fd8d3202ddef383b71c8b6c31a9d77989030efba5be561163d41/inline_snapshot-0.20.8-py3-none-any.whl", hash = "sha256:bded4e142b8817930e4df428b88c462308a8f01ad699852e7574a54bad7ea9f2", size = 48157 },
|
|
615
613
|
]
|
|
616
614
|
|
|
617
|
-
[[package]]
|
|
618
|
-
name = "issubclass"
|
|
619
|
-
version = "0.1.2"
|
|
620
|
-
source = { registry = "https://pypi.org/simple" }
|
|
621
|
-
sdist = { url = "https://files.pythonhosted.org/packages/7d/89/f9a05e3bbc7cc2a5806138e62f2f94504e491411c8d0c994296dcfd0cfaf/issubclass-0.1.2.tar.gz", hash = "sha256:740dabca95adbd25442d1dd616ed455046ab9551c38514758dc291f431fded35", size = 1850 }
|
|
622
|
-
wheels = [
|
|
623
|
-
{ url = "https://files.pythonhosted.org/packages/b1/69/3135026fbb9d4bcdc1e76a9e4c18fc4c6161a6eea6905b76d27eeaa00940/issubclass-0.1.2-py3-none-any.whl", hash = "sha256:ea54b6b27526cf1be49a4bc15d713bef0b480e0230482626a37cf21529da3864", size = 2164 },
|
|
624
|
-
]
|
|
625
|
-
|
|
626
615
|
[[package]]
|
|
627
616
|
name = "jinja2"
|
|
628
617
|
version = "3.1.6"
|
|
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.1.3 → cadwyn-5.2.0}/docs/concepts/where_to_put_the_version_and_how_to_format_it.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cadwyn-5.1.3 → cadwyn-5.2.0}/docs/how_to/change_openapi_schemas/change_schema_without_endpoint.md
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{cadwyn-5.1.3 → cadwyn-5.2.0}/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.1.3 → cadwyn-5.2.0}/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
|