From 705b2438f1db343780fe8e3fb7da742ca7f76e1c Mon Sep 17 00:00:00 2001 From: David Kim Date: Fri, 20 May 2022 19:07:37 +0900 Subject: [PATCH] No need to be Optional[bool] Default is True and If someone doesn't want auto_error option, then it should be False instead of None. I guess It is more Pythonic. --- fastapi/security/oauth2.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fastapi/security/oauth2.py b/fastapi/security/oauth2.py index 888208c1501fc..653c3010e58a3 100644 --- a/fastapi/security/oauth2.py +++ b/fastapi/security/oauth2.py @@ -119,7 +119,7 @@ def __init__( flows: Union[OAuthFlowsModel, Dict[str, Dict[str, Any]]] = OAuthFlowsModel(), scheme_name: Optional[str] = None, description: Optional[str] = None, - auto_error: Optional[bool] = True + auto_error: bool = True ): self.model = OAuth2Model(flows=flows, description=description) self.scheme_name = scheme_name or self.__class__.__name__