mirror of https://github.com/tiangolo/fastapi.git
OAuth2PasswordRequestForm: set OpenAPI format to password for fields password and client secret
This commit is contained in:
parent
92feb73531
commit
0236eb45e6
|
|
@ -85,7 +85,7 @@ class OAuth2PasswordRequestForm:
|
|||
],
|
||||
password: Annotated[
|
||||
str,
|
||||
Form(),
|
||||
Form(json_schema_extra={"format": "password"}),
|
||||
Doc(
|
||||
"""
|
||||
`password` string. The OAuth2 spec requires the exact field name
|
||||
|
|
@ -130,7 +130,7 @@ class OAuth2PasswordRequestForm:
|
|||
] = None,
|
||||
client_secret: Annotated[
|
||||
Union[str, None],
|
||||
Form(),
|
||||
Form(json_schema_extra={"format": "password"}),
|
||||
Doc(
|
||||
"""
|
||||
If there's a `client_password` (and a `client_id`), they can be sent
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ def test_openapi_schema():
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -161,6 +161,7 @@ def test_openapi_schema():
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ def test_openapi_schema():
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -161,6 +161,7 @@ def test_openapi_schema():
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -177,6 +177,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -177,6 +177,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -177,6 +177,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ def test_openapi_schema():
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -355,6 +355,7 @@ def test_openapi_schema():
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -339,7 +339,7 @@ def test_openapi_schema():
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -355,6 +355,7 @@ def test_openapi_schema():
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -383,6 +383,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -383,6 +383,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -383,6 +383,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
|
|
@ -367,7 +367,7 @@ def test_openapi_schema(client: TestClient):
|
|||
}
|
||||
),
|
||||
"username": {"title": "Username", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string"},
|
||||
"password": {"title": "Password", "type": "string", "format": "password"},
|
||||
"scope": {"title": "Scope", "type": "string", "default": ""},
|
||||
"client_id": IsDict(
|
||||
{
|
||||
|
|
@ -383,6 +383,7 @@ def test_openapi_schema(client: TestClient):
|
|||
{
|
||||
"title": "Client Secret",
|
||||
"anyOf": [{"type": "string"}, {"type": "null"}],
|
||||
"format": "password",
|
||||
}
|
||||
)
|
||||
| IsDict(
|
||||
|
|
|
|||
Loading…
Reference in New Issue