Skip to content

Commit 22fd8a5

Browse files
authored
Mark account routes as internal and include in schema (#12264)
1 parent 1ebbd16 commit 22fd8a5

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

openlibrary/fastapi/account.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from __future__ import annotations
66

7+
import os
78
from typing import Annotated
89
from urllib.parse import unquote
910

@@ -22,6 +23,8 @@
2223

2324
router = APIRouter()
2425

26+
SHOW_INTERNAL_IN_SCHEMA = os.getenv("LOCAL_DEV") is not None
27+
2528

2629
class AuthTestResponse(BaseModel):
2730
"""Response model for the auth test endpoint."""
@@ -36,8 +39,7 @@ class AuthTestResponse(BaseModel):
3639
cookie_parsed: dict = Field(..., description="Parsed cookie components")
3740

3841

39-
# TODO: Delete this before merging, it's just for local testing for now.
40-
@router.get("/account/test.json", response_model=AuthTestResponse)
42+
@router.get("/account/test.json", response_model=AuthTestResponse, tags=["internal"], include_in_schema=SHOW_INTERNAL_IN_SCHEMA)
4143
async def check_authentication(
4244
request: Request,
4345
user: Annotated[AuthenticatedUser | None, Depends(get_authenticated_user)],
@@ -91,8 +93,7 @@ async def check_authentication(
9193
)
9294

9395

94-
# TODO: Delete this before merging, it's just for local testing for now.
95-
@router.get("/account/protected.json")
96+
@router.get("/account/protected.json", tags=["internal"], include_in_schema=SHOW_INTERNAL_IN_SCHEMA)
9697
async def protected_endpoint(
9798
user: Annotated[AuthenticatedUser, Depends(require_authenticated_user)],
9899
) -> dict:
@@ -114,8 +115,7 @@ async def protected_endpoint(
114115
}
115116

116117

117-
# TODO: Delete this before merging, it's just for local testing for now.
118-
@router.get("/account/optional.json")
118+
@router.get("/account/optional.json", tags=["internal"], include_in_schema=SHOW_INTERNAL_IN_SCHEMA)
119119
async def optional_auth_endpoint(
120120
user: Annotated[AuthenticatedUser | None, Depends(get_authenticated_user)],
121121
) -> dict:

0 commit comments

Comments
 (0)