Browse Source

🎨 Auto format

pull/15318/head
pre-commit-ci-lite[bot] 3 months ago
committed by GitHub
parent
commit
d50bbb487d
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 6
      fastapi/encoders.py
  2. 2
      fastapi/security/http.py
  3. 4
      fastapi/security/oauth2.py
  4. 4
      tests/test_application.py
  5. 8
      tests/test_infer_param_optionality.py
  6. 4
      tests/test_multi_query_errors.py
  7. 12
      tests/test_openapi_examples.py
  8. 4
      tests/test_regex_deprecated_params.py
  9. 104
      tests/test_request_params/test_cookie/test_optional_str.py
  10. 72
      tests/test_request_params/test_cookie/test_required_str.py
  11. 92
      tests/test_request_params/test_header/test_list.py
  12. 116
      tests/test_request_params/test_header/test_optional_list.py
  13. 104
      tests/test_request_params/test_header/test_optional_str.py
  14. 72
      tests/test_request_params/test_header/test_required_str.py
  15. 92
      tests/test_request_params/test_query/test_list.py
  16. 116
      tests/test_request_params/test_query/test_optional_list.py
  17. 104
      tests/test_request_params/test_query/test_optional_str.py
  18. 72
      tests/test_request_params/test_query/test_required_str.py
  19. 36
      tests/test_schema_extra_examples.py
  20. 4
      tests/test_sub_callbacks.py
  21. 4
      tests/test_tutorial/test_additional_responses/test_tutorial002.py
  22. 4
      tests/test_tutorial/test_additional_responses/test_tutorial004.py
  23. 4
      tests/test_tutorial/test_body/test_tutorial004.py
  24. 8
      tests/test_tutorial/test_body_multiple_params/test_tutorial001.py
  25. 4
      tests/test_tutorial/test_body_multiple_params/test_tutorial004.py
  26. 20
      tests/test_tutorial/test_cookie_param_models/test_tutorial001.py
  27. 20
      tests/test_tutorial/test_cookie_param_models/test_tutorial002.py
  28. 4
      tests/test_tutorial/test_cookie_params/test_tutorial001.py
  29. 8
      tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py
  30. 4
      tests/test_tutorial/test_dependencies/test_tutorial002_tutorial003_tutorial004.py
  31. 8
      tests/test_tutorial/test_dependencies/test_tutorial005.py
  32. 28
      tests/test_tutorial/test_header_param_models/test_tutorial001.py
  33. 28
      tests/test_tutorial/test_header_param_models/test_tutorial002.py
  34. 28
      tests/test_tutorial/test_header_param_models/test_tutorial003.py
  35. 4
      tests/test_tutorial/test_header_params/test_tutorial001.py
  36. 4
      tests/test_tutorial/test_header_params/test_tutorial002.py
  37. 4
      tests/test_tutorial/test_header_params/test_tutorial003.py
  38. 4
      tests/test_tutorial/test_openapi_callbacks/test_tutorial001.py
  39. 4
      tests/test_tutorial/test_path_params_numeric_validations/test_tutorial001.py
  40. 16
      tests/test_tutorial/test_query_param_models/test_tutorial001.py
  41. 16
      tests/test_tutorial/test_query_param_models/test_tutorial002.py
  42. 4
      tests/test_tutorial/test_query_params/test_tutorial002.py
  43. 4
      tests/test_tutorial/test_query_params/test_tutorial003.py
  44. 4
      tests/test_tutorial/test_query_params/test_tutorial004.py
  45. 4
      tests/test_tutorial/test_query_params/test_tutorial006.py
  46. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial001.py
  47. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial002.py
  48. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial003.py
  49. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial004.py
  50. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial007.py
  51. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial008.py
  52. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial009.py
  53. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial011.py
  54. 4
      tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py
  55. 4
      tests/test_tutorial/test_server_sent_events/test_tutorial004.py

6
fastapi/encoders.py

@ -235,7 +235,11 @@ def jsonable_encoder(
)
if sqlalchemy_safe:
result = {k: v for k, v in result.items() if not (isinstance(k, str) and k.startswith("_sa"))}
result = {
k: v
for k, v in result.items()
if not (isinstance(k, str) and k.startswith("_sa"))
}
return result
if dataclasses.is_dataclass(obj):
assert not isinstance(obj, type)

2
fastapi/security/http.py

@ -315,6 +315,7 @@ class HTTPBearer(HTTPBase):
return None
return HTTPAuthorizationCredentials(scheme=scheme, credentials=credentials)
class HTTPCookieBearer(SecurityBase):
"""
Bearer token authentication via a named cookie (e.g. `access_token`).
@ -363,6 +364,7 @@ class HTTPCookieBearer(SecurityBase):
return None
return HTTPAuthorizationCredentials(scheme="Bearer", credentials=token)
class HTTPDigest(HTTPBase):
"""
HTTP Digest authentication.

4
fastapi/security/oauth2.py

@ -1,3 +1,4 @@
import secrets
from typing import Annotated, Any, cast
from annotated_doc import Doc
@ -8,9 +9,8 @@ from fastapi.param_functions import Form
from fastapi.security.base import SecurityBase
from fastapi.security.utils import get_authorization_scheme_param
from starlette.requests import Request
from starlette.status import HTTP_401_UNAUTHORIZED
from starlette.responses import RedirectResponse
import secrets
from starlette.status import HTTP_401_UNAUTHORIZED
class OAuth2PasswordRequestForm:

4
tests/test_application.py

@ -982,7 +982,9 @@ def test_openapi_schema():
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "integer"}, {"type": "null"}], "default": None, "title": "Query",
"anyOf": [{"type": "integer"}, {"type": "null"}],
"default": None,
"title": "Query",
},
}
],

8
tests/test_infer_param_optionality.py

@ -163,7 +163,9 @@ def test_openapi_schema():
"name": "user_id",
"in": "query",
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "User Id",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "User Id",
},
}
],
@ -201,7 +203,9 @@ def test_openapi_schema():
"name": "user_id",
"in": "query",
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "User Id",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "User Id",
},
},
],

4
tests/test_multi_query_errors.py

@ -73,7 +73,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"title": "Q",
"type": "array", "default": None, "items": {"type": "integer"},
"type": "array",
"default": None,
"items": {"type": "integer"},
},
"name": "q",
"in": "query",

12
tests/test_openapi_examples.py

@ -255,7 +255,9 @@ def test_openapi_schema():
"examples": [
"json_schema_query1",
"json_schema_query2",
], "default": None, "title": "Data",
],
"default": None,
"title": "Data",
},
"examples": {
"Query One": {
@ -299,7 +301,9 @@ def test_openapi_schema():
"examples": [
"json_schema_header1",
"json_schema_header2",
], "default": None, "title": "Data",
],
"default": None,
"title": "Data",
},
"examples": {
"Header One": {
@ -343,7 +347,9 @@ def test_openapi_schema():
"examples": [
"json_schema_cookie1",
"json_schema_cookie2",
], "default": None, "title": "Data",
],
"default": None,
"title": "Data",
},
"examples": {
"Cookie One": {

4
tests/test_regex_deprecated_params.py

@ -83,7 +83,9 @@ def test_openapi_schema():
"anyOf": [
{"type": "string", "pattern": "^fixedquery$"},
{"type": "null"},
], "default": None, "title": "Q",
],
"default": None,
"title": "Q",
},
}
],

104
tests/test_request_params/test_cookie/test_optional_str.py

@ -31,18 +31,20 @@ async def read_model_optional_str(p: Annotated[CookieModelOptionalStr, Cookie()]
["/optional-str", "/model-optional-str"],
)
def test_optional_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P",
},
}
]
)
@pytest.mark.parametrize(
@ -93,18 +95,20 @@ async def read_model_optional_alias(p: Annotated[CookieModelOptionalAlias, Cooki
["/optional-alias", "/model-optional-alias"],
)
def test_optional_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -172,18 +176,20 @@ def read_model_optional_validation_alias(
["/optional-validation-alias", "/model-optional-validation-alias"],
)
def test_optional_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -259,18 +265,20 @@ def read_model_optional_alias_and_validation_alias(
],
)
def test_optional_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

72
tests/test_request_params/test_cookie/test_required_str.py

@ -32,14 +32,16 @@ async def read_model_required_str(p: Annotated[CookieModelRequiredStr, Cookie()]
["/required-str", "/model-required-str"],
)
def test_required_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P"},
}
]
)
@pytest.mark.parametrize(
@ -97,14 +99,16 @@ async def read_model_required_alias(p: Annotated[CookieModelRequiredAlias, Cooki
["/required-alias", "/model-required-alias"],
)
def test_required_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P Alias"},
}
]
)
@pytest.mark.parametrize(
@ -196,14 +200,16 @@ def read_model_required_validation_alias(
["/required-validation-alias", "/model-required-validation-alias"],
)
def test_required_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
]
)
@pytest.mark.parametrize(
@ -303,14 +309,16 @@ def read_model_required_alias_and_validation_alias(
],
)
def test_required_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
]
)
@pytest.mark.parametrize(

92
tests/test_request_params/test_header/test_list.py

@ -32,14 +32,16 @@ def read_model_required_list_str(p: Annotated[HeaderModelRequiredListStr, Header
["/required-list-str", "/model-required-list-str"],
)
def test_required_list_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "header",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}, "title": "P"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "header",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}, "title": "P"},
}
]
)
@pytest.mark.parametrize(
@ -98,14 +100,20 @@ async def read_model_required_list_alias(
["/required-list-alias", "/model-required-list-alias"],
)
def test_required_list_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "header",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}, "title": "P Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "header",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -192,18 +200,20 @@ async def read_model_required_list_validation_alias(
["/required-list-validation-alias", "/model-required-list-validation-alias"],
)
def test_required_list_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -300,18 +310,20 @@ def read_model_required_list_alias_and_validation_alias(
],
)
def test_required_list_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

116
tests/test_request_params/test_header/test_optional_list.py

@ -35,18 +35,23 @@ async def read_model_optional_list_str(
["/optional-list-str", "/model-optional-list-str"],
)
def test_optional_list_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "header",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P",
},
}
]
)
@pytest.mark.parametrize(
@ -98,18 +103,23 @@ async def read_model_optional_list_alias(
["/optional-list-alias", "/model-optional-list-alias"],
)
def test_optional_list_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -175,18 +185,23 @@ def read_model_optional_list_validation_alias(
["/optional-list-validation-alias", "/model-optional-list-validation-alias"],
)
def test_optional_list_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -259,18 +274,23 @@ def read_model_optional_list_alias_and_validation_alias(
],
)
def test_optional_list_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

104
tests/test_request_params/test_header/test_optional_str.py

@ -31,18 +31,20 @@ async def read_model_optional_str(p: Annotated[HeaderModelOptionalStr, Header()]
["/optional-str", "/model-optional-str"],
)
def test_optional_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P",
},
}
]
)
@pytest.mark.parametrize(
@ -92,18 +94,20 @@ async def read_model_optional_alias(p: Annotated[HeaderModelOptionalAlias, Heade
["/optional-alias", "/model-optional-alias"],
)
def test_optional_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -169,18 +173,20 @@ def read_model_optional_validation_alias(
["/optional-validation-alias", "/model-optional-validation-alias"],
)
def test_optional_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -254,18 +260,20 @@ def read_model_optional_alias_and_validation_alias(
],
)
def test_optional_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

72
tests/test_request_params/test_header/test_required_str.py

@ -32,14 +32,16 @@ async def read_model_required_str(p: Annotated[HeaderModelRequiredStr, Header()]
["/required-str", "/model-required-str"],
)
def test_required_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P"},
}
]
)
@pytest.mark.parametrize(
@ -96,14 +98,16 @@ async def read_model_required_alias(p: Annotated[HeaderModelRequiredAlias, Heade
["/required-alias", "/model-required-alias"],
)
def test_required_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P Alias"},
}
]
)
@pytest.mark.parametrize(
@ -190,14 +194,16 @@ def read_model_required_validation_alias(
["/required-validation-alias", "/model-required-validation-alias"],
)
def test_required_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
]
)
@pytest.mark.parametrize(
@ -295,14 +301,16 @@ def read_model_required_alias_and_validation_alias(
],
)
def test_required_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
]
)
@pytest.mark.parametrize(

92
tests/test_request_params/test_query/test_list.py

@ -32,14 +32,16 @@ def read_model_required_list_str(p: Annotated[QueryModelRequiredListStr, Query()
["/required-list-str", "/model-required-list-str"],
)
def test_required_list_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "query",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}, "title": "P"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "query",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}, "title": "P"},
}
]
)
@pytest.mark.parametrize(
@ -98,14 +100,20 @@ async def read_model_required_list_alias(
["/required-list-alias", "/model-required-list-alias"],
)
def test_required_list_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "query",
"required": True,
"schema": {"type": "array", "items": {"type": "string"}, "title": "P Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "query",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -192,18 +200,20 @@ async def read_model_required_list_validation_alias(
["/required-list-validation-alias", "/model-required-list-validation-alias"],
)
def test_required_list_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -298,18 +308,20 @@ def read_model_required_list_alias_and_validation_alias(
],
)
def test_required_list_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {
"type": "array",
"items": {"type": "string"},
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

116
tests/test_request_params/test_query/test_optional_list.py

@ -35,18 +35,23 @@ async def read_model_optional_list_str(
["/optional-list-str", "/model-optional-list-str"],
)
def test_optional_list_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "query",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P",
},
}
]
)
@pytest.mark.parametrize(
@ -98,18 +103,23 @@ async def read_model_optional_list_alias(
["/optional-list-alias", "/model-optional-list-alias"],
)
def test_optional_list_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -175,18 +185,23 @@ def read_model_optional_list_validation_alias(
["/optional-list-validation-alias", "/model-optional-list-validation-alias"],
)
def test_optional_list_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -257,18 +272,23 @@ def read_model_optional_list_alias_and_validation_alias(
],
)
def test_optional_list_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "array", "items": {"type": "string"}}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

104
tests/test_request_params/test_query/test_optional_str.py

@ -31,18 +31,20 @@ async def read_model_optional_str(p: Annotated[QueryModelOptionalStr, Query()]):
["/optional-str", "/model-optional-str"],
)
def test_optional_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P",
},
}
]
)
@pytest.mark.parametrize(
@ -92,18 +94,20 @@ async def read_model_optional_alias(p: Annotated[QueryModelOptionalAlias, Query(
["/optional-alias", "/model-optional-alias"],
)
def test_optional_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -169,18 +173,20 @@ def read_model_optional_validation_alias(
["/optional-validation-alias", "/model-optional-validation-alias"],
)
def test_optional_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(
@ -254,18 +260,20 @@ def read_model_optional_alias_and_validation_alias(
],
)
def test_optional_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "P Val Alias",
},
}
]
)
@pytest.mark.parametrize(

72
tests/test_request_params/test_query/test_required_str.py

@ -32,14 +32,16 @@ async def read_model_required_str(p: Annotated[QueryModelRequiredStr, Query()]):
["/required-str", "/model-required-str"],
)
def test_required_str_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P"},
}
]
)
@pytest.mark.parametrize(
@ -96,14 +98,16 @@ async def read_model_required_alias(p: Annotated[QueryModelRequiredAlias, Query(
["/required-alias", "/model-required-alias"],
)
def test_required_str_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_alias",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_alias",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P Alias"},
}
]
)
@pytest.mark.parametrize(
@ -193,14 +197,16 @@ def read_model_required_validation_alias(
["/required-validation-alias", "/model-required-validation-alias"],
)
def test_required_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
]
)
@pytest.mark.parametrize(
@ -298,14 +304,16 @@ def read_model_required_alias_and_validation_alias(
],
)
def test_required_alias_and_validation_alias_schema(path: str):
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot([
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
])
assert app.openapi()["paths"][path]["get"]["parameters"] == snapshot(
[
{
"name": "p_val_alias",
"in": "query",
"required": True,
"schema": {"type": "string", "title": "P Val Alias"},
}
]
)
@pytest.mark.parametrize(

36
tests/test_schema_extra_examples.py

@ -509,7 +509,9 @@ def test_openapi_schema():
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Data",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Data",
},
"example": "query1",
"name": "data",
@ -543,7 +545,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Data", "default": None, "examples": ["query1", "query2"],
"title": "Data",
"default": None,
"examples": ["query1", "query2"],
},
"name": "data",
"in": "query",
@ -576,7 +580,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Data", "default": None, "examples": ["query1", "query2"],
"title": "Data",
"default": None,
"examples": ["query1", "query2"],
},
"example": "query_overridden",
"name": "data",
@ -609,7 +615,9 @@ def test_openapi_schema():
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Data",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Data",
},
"example": "header1",
"name": "data",
@ -643,7 +651,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Data", "default": None, "examples": ["header1", "header2"],
"title": "Data",
"default": None,
"examples": ["header1", "header2"],
},
"name": "data",
"in": "header",
@ -676,7 +686,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Data", "default": None, "examples": ["header1", "header2"],
"title": "Data",
"default": None,
"examples": ["header1", "header2"],
},
"example": "header_overridden",
"name": "data",
@ -709,7 +721,9 @@ def test_openapi_schema():
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Data",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Data",
},
"example": "cookie1",
"name": "data",
@ -743,7 +757,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Data", "default": None, "examples": ["cookie1", "cookie2"],
"title": "Data",
"default": None,
"examples": ["cookie1", "cookie2"],
},
"name": "data",
"in": "cookie",
@ -776,7 +792,9 @@ def test_openapi_schema():
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}],
"title": "Data", "default": None, "examples": ["cookie1", "cookie2"],
"title": "Data",
"default": None,
"examples": ["cookie1", "cookie2"],
},
"example": "cookie_overridden",
"name": "data",

4
tests/test_sub_callbacks.py

@ -113,7 +113,9 @@ And this path operation will:
{
"required": False,
"schema": {
"title": "Callback Url", "default": None, "anyOf": [
"title": "Callback Url",
"default": None,
"anyOf": [
{
"type": "string",
"format": "uri",

4
tests/test_tutorial/test_additional_responses/test_tutorial002.py

@ -82,7 +82,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "boolean"}, {"type": "null"}], "default": None, "title": "Img",
"anyOf": [{"type": "boolean"}, {"type": "null"}],
"default": None,
"title": "Img",
},
"name": "img",
"in": "query",

4
tests/test_tutorial/test_additional_responses/test_tutorial004.py

@ -85,7 +85,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "boolean"}, {"type": "null"}], "default": None, "title": "Img",
"anyOf": [{"type": "boolean"}, {"type": "null"}],
"default": None,
"title": "Img",
},
"name": "img",
"in": "query",

4
tests/test_tutorial/test_body/test_tutorial004.py

@ -96,7 +96,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

8
tests/test_tutorial/test_body_multiple_params/test_tutorial001.py

@ -106,7 +106,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",
@ -119,7 +121,9 @@ def test_openapi_schema(client: TestClient):
"anyOf": [
{"$ref": "#/components/schemas/Item"},
{"type": "null"},
], "default": None, "title": "Item",
],
"default": None,
"title": "Item",
}
}
}

4
tests/test_tutorial/test_body_multiple_params/test_tutorial004.py

@ -193,7 +193,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

20
tests/test_tutorial/test_cookie_param_models/test_tutorial001.py

@ -92,21 +92,31 @@ def test_openapi_schema(client: TestClient):
"name": "session_id",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "Session Id"}, "example": None},
"schema": {"type": "string", "title": "Session Id"},
"example": None,
},
{
"name": "fatebook_tracker",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Fatebook Tracker",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Fatebook Tracker",
},
"example": None,
},
{
"name": "googall_tracker",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Googall Tracker",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Googall Tracker",
},
"example": None,
},
],
"responses": {
"200": {

20
tests/test_tutorial/test_cookie_param_models/test_tutorial002.py

@ -99,7 +99,9 @@ def test_openapi_schema(client: TestClient):
"name": "session_id",
"in": "cookie",
"required": True,
"schema": {"type": "string", "title": "Session Id"}, "example": None},
"schema": {"type": "string", "title": "Session Id"},
"example": None,
},
{
"name": "fatebook_tracker",
"in": "cookie",
@ -108,15 +110,23 @@ def test_openapi_schema(client: TestClient):
"anyOf": [
{"type": "string"},
{"type": "null"},
], "default": None, "title": "Fatebook Tracker",
}, "example": None},
],
"default": None,
"title": "Fatebook Tracker",
},
"example": None,
},
{
"name": "googall_tracker",
"in": "cookie",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Googall Tracker",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Googall Tracker",
},
"example": None,
},
],
"responses": {
"200": {

4
tests/test_tutorial/test_cookie_params/test_tutorial001.py

@ -75,7 +75,9 @@ def test_openapi_schema(mod: ModuleType):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Ads Id",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Ads Id",
},
"name": "ads_id",
"in": "cookie",

8
tests/test_tutorial/test_dependencies/test_tutorial001_tutorial001_02.py

@ -70,7 +70,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",
@ -122,7 +124,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

4
tests/test_tutorial/test_dependencies/test_tutorial002_tutorial003_tutorial004.py

@ -111,7 +111,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

8
tests/test_tutorial/test_dependencies/test_tutorial005.py

@ -86,7 +86,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Q",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",
@ -94,7 +96,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Last Query",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Last Query",
},
"name": "last_query",
"in": "cookie",

28
tests/test_tutorial/test_header_param_models/test_tutorial001.py

@ -111,26 +111,38 @@ def test_openapi_schema(client: TestClient):
"name": "host",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "Host"}, "example": None},
"schema": {"type": "string", "title": "Host"},
"example": None,
},
{
"name": "save-data",
"in": "header",
"required": True,
"schema": {"type": "boolean", "title": "Save Data"}, "example": None},
"schema": {"type": "boolean", "title": "Save Data"},
"example": None,
},
{
"name": "if-modified-since",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "If Modified Since",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "If Modified Since",
},
"example": None,
},
{
"name": "traceparent",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Traceparent",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Traceparent",
},
"example": None,
},
{
"name": "x-tag",
"in": "header",
@ -140,7 +152,9 @@ def test_openapi_schema(client: TestClient):
"items": {"type": "string"},
"default": [],
"title": "X Tag",
}, "example": None},
},
"example": None,
},
],
"responses": {
"200": {

28
tests/test_tutorial/test_header_param_models/test_tutorial002.py

@ -108,26 +108,38 @@ def test_openapi_schema(client: TestClient):
"name": "host",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "Host"}, "example": None},
"schema": {"type": "string", "title": "Host"},
"example": None,
},
{
"name": "save-data",
"in": "header",
"required": True,
"schema": {"type": "boolean", "title": "Save Data"}, "example": None},
"schema": {"type": "boolean", "title": "Save Data"},
"example": None,
},
{
"name": "if-modified-since",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "If Modified Since",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "If Modified Since",
},
"example": None,
},
{
"name": "traceparent",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Traceparent",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Traceparent",
},
"example": None,
},
{
"name": "x-tag",
"in": "header",
@ -137,7 +149,9 @@ def test_openapi_schema(client: TestClient):
"items": {"type": "string"},
"default": [],
"title": "X Tag",
}, "example": None},
},
"example": None,
},
],
"responses": {
"200": {

28
tests/test_tutorial/test_header_param_models/test_tutorial003.py

@ -148,26 +148,38 @@ def test_openapi_schema(client: TestClient):
"name": "host",
"in": "header",
"required": True,
"schema": {"type": "string", "title": "Host"}, "example": None},
"schema": {"type": "string", "title": "Host"},
"example": None,
},
{
"name": "save_data",
"in": "header",
"required": True,
"schema": {"type": "boolean", "title": "Save Data"}, "example": None},
"schema": {"type": "boolean", "title": "Save Data"},
"example": None,
},
{
"name": "if_modified_since",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "If Modified Since",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "If Modified Since",
},
"example": None,
},
{
"name": "traceparent",
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Traceparent",
}, "example": None},
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Traceparent",
},
"example": None,
},
{
"name": "x_tag",
"in": "header",
@ -177,7 +189,9 @@ def test_openapi_schema(client: TestClient):
"items": {"type": "string"},
"default": [],
"title": "X Tag",
}, "example": None},
},
"example": None,
},
],
"responses": {
"200": {

4
tests/test_tutorial/test_header_params/test_tutorial001.py

@ -67,7 +67,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "User-Agent",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "User-Agent",
},
"name": "user-agent",
"in": "header",

4
tests/test_tutorial/test_header_params/test_tutorial002.py

@ -78,7 +78,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Strange Header",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Strange Header",
},
"name": "strange_header",
"in": "header",

4
tests/test_tutorial/test_header_params/test_tutorial003.py

@ -56,7 +56,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"title": "X-Token", "default": None, "anyOf": [
"title": "X-Token",
"default": None,
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
],

4
tests/test_tutorial/test_openapi_callbacks/test_tutorial001.py

@ -78,7 +78,9 @@ And this path operation will:
"maxLength": 2083,
},
{"type": "null"},
], "default": None, "title": "Callback Url",
],
"default": None,
"title": "Callback Url",
},
"name": "callback_url",
"in": "query",

4
tests/test_tutorial/test_path_params_numeric_validations/test_tutorial001.py

@ -81,7 +81,9 @@ def test_openapi_schema(client: TestClient):
{
"type": "null",
},
], "default": None, "title": "Item-Query",
],
"default": None,
"title": "Item-Query",
},
"name": "item-query",
"in": "query",

16
tests/test_tutorial/test_query_param_models/test_tutorial001.py

@ -133,7 +133,9 @@ def test_openapi_schema(client: TestClient):
"exclusiveMinimum": 0,
"default": 100,
"title": "Limit",
}, "example": None},
},
"example": None,
},
{
"name": "offset",
"in": "query",
@ -143,7 +145,9 @@ def test_openapi_schema(client: TestClient):
"minimum": 0,
"default": 0,
"title": "Offset",
}, "example": None},
},
"example": None,
},
{
"name": "order_by",
"in": "query",
@ -153,7 +157,9 @@ def test_openapi_schema(client: TestClient):
"type": "string",
"default": "created_at",
"title": "Order By",
}, "example": None},
},
"example": None,
},
{
"name": "tags",
"in": "query",
@ -163,7 +169,9 @@ def test_openapi_schema(client: TestClient):
"items": {"type": "string"},
"default": [],
"title": "Tags",
}, "example": None},
},
"example": None,
},
],
"responses": {
"200": {

16
tests/test_tutorial/test_query_param_models/test_tutorial002.py

@ -139,7 +139,9 @@ def test_openapi_schema(client: TestClient):
"exclusiveMinimum": 0,
"default": 100,
"title": "Limit",
}, "example": None},
},
"example": None,
},
{
"name": "offset",
"in": "query",
@ -149,7 +151,9 @@ def test_openapi_schema(client: TestClient):
"minimum": 0,
"default": 0,
"title": "Offset",
}, "example": None},
},
"example": None,
},
{
"name": "order_by",
"in": "query",
@ -159,7 +163,9 @@ def test_openapi_schema(client: TestClient):
"type": "string",
"default": "created_at",
"title": "Order By",
}, "example": None},
},
"example": None,
},
{
"name": "tags",
"in": "query",
@ -169,7 +175,9 @@ def test_openapi_schema(client: TestClient):
"items": {"type": "string"},
"default": [],
"title": "Tags",
}, "example": None},
},
"example": None,
},
],
"responses": {
"200": {

4
tests/test_tutorial/test_query_params/test_tutorial002.py

@ -61,7 +61,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"title": "Q", "default": None, "anyOf": [
"title": "Q",
"default": None,
"anyOf": [
{
"type": "string",
},

4
tests/test_tutorial/test_query_params/test_tutorial003.py

@ -72,7 +72,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"title": "Q", "default": None, "anyOf": [
"title": "Q",
"default": None,
"anyOf": [
{
"type": "string",
},

4
tests/test_tutorial/test_query_params/test_tutorial004.py

@ -80,7 +80,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"title": "Q", "default": None, "anyOf": [
"title": "Q",
"default": None,
"anyOf": [
{
"type": "string",
},

4
tests/test_tutorial/test_query_params/test_tutorial006.py

@ -112,7 +112,9 @@ def test_openapi_schema(client: TestClient):
{
"required": False,
"schema": {
"anyOf": [{"type": "integer"}, {"type": "null"}], "default": None, "title": "Limit",
"anyOf": [{"type": "integer"}, {"type": "null"}],
"default": None,
"title": "Limit",
},
"name": "limit",
"in": "query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial001.py

@ -78,7 +78,9 @@ def test_openapi_schema(client: TestClient):
"anyOf": [
{"type": "string"},
{"type": "null"},
], "default": None, "title": "Q",
],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial002.py

@ -98,7 +98,9 @@ def test_openapi_schema(client: TestClient):
"maxLength": 50,
},
{"type": "null"},
], "default": None, "title": "Q",
],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial003.py

@ -109,7 +109,9 @@ def test_openapi_schema(client: TestClient):
"maxLength": 50,
},
{"type": "null"},
], "default": None, "title": "Q",
],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial004.py

@ -94,7 +94,9 @@ def test_openapi_schema(client: TestClient):
"pattern": "^fixedquery$",
},
{"type": "null"},
], "default": None, "title": "Q",
],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial007.py

@ -93,7 +93,9 @@ def test_openapi_schema(client: TestClient):
},
{"type": "null"},
],
"title": "Query string", "default": None},
"title": "Query string",
"default": None,
},
"name": "q",
"in": "query",
}

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial008.py

@ -95,7 +95,9 @@ def test_openapi_schema(client: TestClient):
{"type": "null"},
],
"title": "Query string",
"description": "Query string for the items to search in the database that have a good match", "default": None},
"description": "Query string for the items to search in the database that have a good match",
"default": None,
},
"name": "q",
"in": "query",
}

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial009.py

@ -78,7 +78,9 @@ def test_openapi_schema(client: TestClient):
"anyOf": [
{"type": "string"},
{"type": "null"},
], "default": None, "title": "Item-Query",
],
"default": None,
"title": "Item-Query",
},
"required": False,
"name": "item-query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial011.py

@ -72,7 +72,9 @@ def test_openapi_schema(client: TestClient):
"anyOf": [
{"type": "array", "items": {"type": "string"}},
{"type": "null"},
], "default": None, "title": "Q",
],
"default": None,
"title": "Q",
},
"name": "q",
"in": "query",

4
tests/test_tutorial/test_query_params_str_validations/test_tutorial015.py

@ -80,7 +80,9 @@ def test_openapi_schema(client: TestClient):
"in": "query",
"required": False,
"schema": {
"anyOf": [{"type": "string"}, {"type": "null"}], "default": None, "title": "Id",
"anyOf": [{"type": "string"}, {"type": "null"}],
"default": None,
"title": "Id",
},
}
],

4
tests/test_tutorial/test_server_sent_events/test_tutorial004.py

@ -86,7 +86,9 @@ def test_openapi_schema(client: TestClient):
"in": "header",
"required": False,
"schema": {
"anyOf": [{"type": "integer"}, {"type": "null"}], "default": None, "title": "Last-Event-Id",
"anyOf": [{"type": "integer"}, {"type": "null"}],
"default": None,
"title": "Last-Event-Id",
},
}
],

Loading…
Cancel
Save