Skip to content

Commit 89bb35b

Browse files
Merge pull request #741 from DataIntegrationGroup/fix/general-types-fix
fix(openapi): resolve schema generation failures
2 parents 3a9fcc5 + 5c3e8af commit 89bb35b

2 files changed

Lines changed: 13 additions & 14 deletions

File tree

core/app.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,8 @@ def public_openapi():
128128
(
129129
r
130130
for r in app.routes
131-
if r.path == path and method.upper() in r.methods
131+
if getattr(r, "path", None) == path
132+
and method.upper() in getattr(r, "methods", set())
132133
),
133134
None,
134135
)

core/dependencies.py

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515
# ===============================================================================
16-
from typing import Annotated
16+
from typing import Annotated, TypeAlias
1717

1818
from fastapi import Depends
1919
from sqlalchemy.orm import Session
2020

2121
from core.permissions import authenticated
2222
from db.engine import get_db_session
2323

24-
session_dependency: type[Session] = Annotated[Session, Depends(get_db_session)]
24+
session_dependency: TypeAlias = Annotated[Session, Depends(get_db_session)]
2525

2626
"""
2727
Developer Notes
@@ -61,18 +61,16 @@
6161

6262

6363
# Permissions Dependencies -----------------------------------------------------
64-
admin_dependency: type[dict] = Annotated[dict, Depends(admin_function)]
65-
editor_dependency: type[dict] = Annotated[dict, Depends(editor_function)]
66-
viewer_dependency: type[dict] = Annotated[dict, Depends(viewer_function)]
64+
admin_dependency: TypeAlias = Annotated[dict, Depends(admin_function)]
65+
editor_dependency: TypeAlias = Annotated[dict, Depends(editor_function)]
66+
viewer_dependency: TypeAlias = Annotated[dict, Depends(viewer_function)]
6767

68-
lexicon_admin_dependency: type[dict] = Annotated[dict, Depends(lexicon_admin_function)]
69-
lexicon_editor_dependency: type[dict] = Annotated[
70-
dict, Depends(lexicon_editor_function)
71-
]
68+
lexicon_admin_dependency: TypeAlias = Annotated[dict, Depends(lexicon_admin_function)]
69+
lexicon_editor_dependency: TypeAlias = Annotated[dict, Depends(lexicon_editor_function)]
7270

73-
amp_admin_dependency: type[dict] = Annotated[dict, Depends(amp_admin_function)]
74-
amp_editor_dependency: type[dict] = Annotated[dict, Depends(amp_editor_function)]
75-
amp_viewer_dependency: type[dict] = Annotated[dict, Depends(amp_viewer_function)]
71+
amp_admin_dependency: TypeAlias = Annotated[dict, Depends(amp_admin_function)]
72+
amp_editor_dependency: TypeAlias = Annotated[dict, Depends(amp_editor_function)]
73+
amp_viewer_dependency: TypeAlias = Annotated[dict, Depends(amp_viewer_function)]
7674

77-
no_permission_dependency: type[dict] = Annotated[dict, Depends(no_permission_function)]
75+
no_permission_dependency: TypeAlias = Annotated[dict, Depends(no_permission_function)]
7876
# ============= EOF =============================================

0 commit comments

Comments
 (0)