44
55from __future__ import annotations
66
7+ import os
78from typing import Annotated
89from urllib .parse import unquote
910
2223
2324router = APIRouter ()
2425
26+ SHOW_INTERNAL_IN_SCHEMA = os .getenv ("LOCAL_DEV" ) is not None
27+
2528
2629class 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 )
4143async 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 )
9697async 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 )
119119async def optional_auth_endpoint (
120120 user : Annotated [AuthenticatedUser | None , Depends (get_authenticated_user )],
121121) -> dict :
0 commit comments