cadwyn 5.1.3__tar.gz → 5.1.4__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.1.4}/CHANGELOG.md +6 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/PKG-INFO +1 -1
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/versions.py +8 -6
- {cadwyn-5.1.3 → cadwyn-5.1.4}/pyproject.toml +1 -1
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_data_migrations.py +41 -1
- {cadwyn-5.1.3 → cadwyn-5.1.4}/uv.lock +1 -1
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/CODE_OF_CONDUCT.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/actions/setup-python-uv/action.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/workflows/ci.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/workflows/daily_tests.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/workflows/publish_docs.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.github/workflows/release.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.gitignore +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/.pre-commit-config.yaml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/LICENSE +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/Makefile +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/README.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/__main__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/_asts.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/_importer.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/_render.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/_utils.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/applications.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/changelogs.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/dependencies.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/exceptions.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/middleware.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/py.typed +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/route_generation.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/routing.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/schema_generation.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/static/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/static/docs.html +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/common.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/data.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/endpoints.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/enums.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/cadwyn/structure/schemas.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/CNAME +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/api_version_parameter_and_context_variables.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/beware_of_data_versioning.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/changelogs.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/cli.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/endpoint_migrations.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/enum_migrations.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/main_app.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/methodology.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/schema_generation.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/schema_migrations.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/testing.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/version_changes.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/concepts/where_to_put_the_version_and_how_to_format_it.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/home/CONTRIBUTING.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_business_logic/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_endpoints/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_openapi_schemas/add_field.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_openapi_schemas/change_field_type.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_openapi_schemas/change_schema_without_endpoint.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_openapi_schemas/changing_constraints.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_openapi_schemas/remove_field.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/change_openapi_schemas/rename_a_field_in_schema.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/how_to/version_with_paths_and_numbers_instead_of_headers_and_dates.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/img/dashboard_with_one_version.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/img/dashboard_with_two_versions.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/img/get_users_endpoint_from_prior_version.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/img/simplified_migration_model.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/img/sponsor_logos/monite.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/img/unversioned_dashboard.png +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/index.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/plugin.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/quickstart/setup.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/quickstart/tutorial.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/theory/how_to_build_versioning_framework.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/theory/how_we_got_here.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs/theory/literature.md +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/test_block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/change_openapi_schemas/change_schema_without_endpoint/tests/test_block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/how_to/version_with_path_and_numbers_instead_of_headers_and_dates/block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/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.1.4}/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.1.4}/docs_src/quickstart/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/setup/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/setup/block001.sh +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/setup/block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/setup/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/setup/tests/test_block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/block003.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/tests/test_block001.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/tests/test_block002.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/quickstart/tutorial/tests/test_block003.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/docs_src/ruff.toml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/mkdocs.yml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/ruff.toml +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/scripts/fix_links.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/scripts/split_md.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_data/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_data/unversioned_schema_dir/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_data/unversioned_schema_dir/unversioned_schemas.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_data/unversioned_schemas.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/app_for_testing_routing.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/render/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/render/classes.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/render/complex/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/render/complex/classes.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/render/complex/versions.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/render/versions.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/utils.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/versioned_app/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/versioned_app/app.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/versioned_app/v2021_01_01.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/versioned_app/v2022_01_02.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/_resources/versioned_app/webhooks.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/conftest.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_applications.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_auth_dependencies.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_changelog.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_cli.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_render.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_router_generation.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_router_generation_with_from_future_annotations.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_routing.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_schema_generation/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_schema_generation/test_enum.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_schema_generation/test_schema.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_schema_generation/test_schema_field.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_schema_generation/test_schema_validator.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_schema_generation/test_schema_with_future_annotations.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/test_structure.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/tutorial/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/tutorial/main.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/tutorial/test_example.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/versioning_styles/__init__.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tests/versioning_styles/test_versioning_formats.py +0 -0
- {cadwyn-5.1.3 → cadwyn-5.1.4}/tox.ini +0 -0
|
@@ -5,6 +5,12 @@ Please follow [the Keep a Changelog standard](https://keepachangelog.com/en/1.0.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [5.1.4]
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
* a bug where a custom HTTP exception was not being copied correctly so its unique properties are ignored
|
|
13
|
+
|
|
8
14
|
## [5.1.3]
|
|
9
15
|
|
|
10
16
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: cadwyn
|
|
3
|
-
Version: 5.1.
|
|
3
|
+
Version: 5.1.4
|
|
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
|
|
@@ -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
|
|
|
@@ -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"}
|
|
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.1.4}/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.1.4}/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.1.4}/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.1.4}/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
|