Coverage for fastapi / params.py: 100%

101 statements  

« prev     ^ index     » next       coverage.py v7.13.3, created at 2026-02-12 18:15 +0000

1import warnings 1adbc

2from collections.abc import Callable, Sequence 1adbc

3from dataclasses import dataclass 1adbc

4from enum import Enum 1adbc

5from typing import Annotated, Any, Literal 1adbc

6 

7from fastapi.exceptions import FastAPIDeprecationWarning 1adbc

8from fastapi.openapi.models import Example 1adbc

9from pydantic import AliasChoices, AliasPath 1adbc

10from pydantic.fields import FieldInfo 1adbc

11from typing_extensions import deprecated 1adbc

12 

13from ._compat import ( 1adbc

14 Undefined, 

15) 

16 

17_Unset: Any = Undefined 1adbc

18 

19 

20class ParamTypes(Enum): 1adbc

21 query = "query" 1adbc

22 header = "header" 1adbc

23 path = "path" 1adbc

24 cookie = "cookie" 1adbc

25 

26 

27class Param(FieldInfo): # type: ignore[misc] 1adbc

28 in_: ParamTypes 1abc

29 

30 def __init__( 1adbc

31 self, 

32 default: Any = Undefined, 

33 *, 

34 default_factory: Callable[[], Any] | None = _Unset, 

35 annotation: Any | None = None, 

36 alias: str | None = None, 

37 alias_priority: int | None = _Unset, 

38 validation_alias: str | AliasPath | AliasChoices | None = None, 

39 serialization_alias: str | None = None, 

40 title: str | None = None, 

41 description: str | None = None, 

42 gt: float | None = None, 

43 ge: float | None = None, 

44 lt: float | None = None, 

45 le: float | None = None, 

46 min_length: int | None = None, 

47 max_length: int | None = None, 

48 pattern: str | None = None, 

49 regex: Annotated[ 

50 str | None, 

51 deprecated( 

52 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

53 ), 

54 ] = None, 

55 discriminator: str | None = None, 

56 strict: bool | None = _Unset, 

57 multiple_of: float | None = _Unset, 

58 allow_inf_nan: bool | None = _Unset, 

59 max_digits: int | None = _Unset, 

60 decimal_places: int | None = _Unset, 

61 examples: list[Any] | None = None, 

62 example: Annotated[ 

63 Any | None, 

64 deprecated( 

65 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

66 "although still supported. Use examples instead." 

67 ), 

68 ] = _Unset, 

69 openapi_examples: dict[str, Example] | None = None, 

70 deprecated: deprecated | str | bool | None = None, 

71 include_in_schema: bool = True, 

72 json_schema_extra: dict[str, Any] | None = None, 

73 **extra: Any, 

74 ): 

75 if example is not _Unset: 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

76 warnings.warn( 1efghij

77 "`example` has been deprecated, please use `examples` instead", 

78 category=FastAPIDeprecationWarning, 

79 stacklevel=4, 

80 ) 

81 self.example = example 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

82 self.include_in_schema = include_in_schema 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

83 self.openapi_examples = openapi_examples 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

84 kwargs = dict( 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

85 default=default, 

86 default_factory=default_factory, 

87 alias=alias, 

88 title=title, 

89 description=description, 

90 gt=gt, 

91 ge=ge, 

92 lt=lt, 

93 le=le, 

94 min_length=min_length, 

95 max_length=max_length, 

96 discriminator=discriminator, 

97 multiple_of=multiple_of, 

98 allow_inf_nan=allow_inf_nan, 

99 max_digits=max_digits, 

100 decimal_places=decimal_places, 

101 **extra, 

102 ) 

103 if examples is not None: 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

104 kwargs["examples"] = examples 1aefdghbcij

105 if regex is not None: 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

106 warnings.warn( 2;b=b?b@bccdcecfcrcsctcuc

107 "`regex` has been deprecated, please use `pattern` instead", 

108 category=FastAPIDeprecationWarning, 

109 stacklevel=4, 

110 ) 

111 current_json_schema_extra = json_schema_extra or extra 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

112 kwargs["deprecated"] = deprecated 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

113 

114 if serialization_alias in (_Unset, None) and isinstance(alias, str): 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

115 serialization_alias = alias 1adbc

116 if validation_alias in (_Unset, None): 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

117 validation_alias = alias 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

118 kwargs.update( 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

119 { 

120 "annotation": annotation, 

121 "alias_priority": alias_priority, 

122 "validation_alias": validation_alias, 

123 "serialization_alias": serialization_alias, 

124 "strict": strict, 

125 "json_schema_extra": current_json_schema_extra, 

126 } 

127 ) 

128 kwargs["pattern"] = pattern or regex 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

129 

130 use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset} 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

131 

132 super().__init__(**use_kwargs) 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c$ % ' ( ) * + [c]c^c_c'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:bad;b=b?b@be f ; = bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwd? @ [ ] ^ _ ` xdydzdAd]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbcccdcecfcg h bbcbGdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1ddbebfbgbhbibjb2d3d4d5dhcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc#drcsctcuci j pbqb$d%d'd(d)d*dm O P Q

133 

134 def __repr__(self) -> str: 1adbc

135 return f"{self.__class__.__name__}({self.default})" 2'b(b)b*b+b, - . / : `c{c|c}c~cF ,b-b.b/b:b]b^b_b`b{b{ | } ~ abBdCdDdEdFdJ |b}b~bacbchcicjckclckblbmbnbob6d7d8d9d!dN mcncocpcqc

136 

137 

138class Path(Param): # type: ignore[misc] 1adbc

139 in_ = ParamTypes.path 1adbc

140 

141 def __init__( 1adbc

142 self, 

143 default: Any = ..., 

144 *, 

145 default_factory: Callable[[], Any] | None = _Unset, 

146 annotation: Any | None = None, 

147 alias: str | None = None, 

148 alias_priority: int | None = _Unset, 

149 validation_alias: str | AliasPath | AliasChoices | None = None, 

150 serialization_alias: str | None = None, 

151 title: str | None = None, 

152 description: str | None = None, 

153 gt: float | None = None, 

154 ge: float | None = None, 

155 lt: float | None = None, 

156 le: float | None = None, 

157 min_length: int | None = None, 

158 max_length: int | None = None, 

159 pattern: str | None = None, 

160 regex: Annotated[ 

161 str | None, 

162 deprecated( 

163 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

164 ), 

165 ] = None, 

166 discriminator: str | None = None, 

167 strict: bool | None = _Unset, 

168 multiple_of: float | None = _Unset, 

169 allow_inf_nan: bool | None = _Unset, 

170 max_digits: int | None = _Unset, 

171 decimal_places: int | None = _Unset, 

172 examples: list[Any] | None = None, 

173 example: Annotated[ 

174 Any | None, 

175 deprecated( 

176 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

177 "although still supported. Use examples instead." 

178 ), 

179 ] = _Unset, 

180 openapi_examples: dict[str, Example] | None = None, 

181 deprecated: deprecated | str | bool | None = None, 

182 include_in_schema: bool = True, 

183 json_schema_extra: dict[str, Any] | None = None, 

184 **extra: Any, 

185 ): 

186 assert default is ..., "Path parameters cannot have a default value" 2a %b$ % ' ( ) * + F e f ; = G H I d [b? @ [ ] ^ _ ` J g h bbcbK L M b c gcdbebfbgbhbibjbN i j pbqbO P Q

187 self.in_ = self.in_ 2a $ % ' ( ) * + F e f ; = G H I d ? @ [ ] ^ _ ` J g h bbcbK L M b c dbebfbgbhbibjbN i j pbqbO P Q

188 super().__init__( 2a $ % ' ( ) * + F e f ; = G H I d ? @ [ ] ^ _ ` J g h bbcbK L M b c dbebfbgbhbibjbN i j pbqbO P Q

189 default=default, 

190 default_factory=default_factory, 

191 annotation=annotation, 

192 alias=alias, 

193 alias_priority=alias_priority, 

194 validation_alias=validation_alias, 

195 serialization_alias=serialization_alias, 

196 title=title, 

197 description=description, 

198 gt=gt, 

199 ge=ge, 

200 lt=lt, 

201 le=le, 

202 min_length=min_length, 

203 max_length=max_length, 

204 pattern=pattern, 

205 regex=regex, 

206 discriminator=discriminator, 

207 strict=strict, 

208 multiple_of=multiple_of, 

209 allow_inf_nan=allow_inf_nan, 

210 max_digits=max_digits, 

211 decimal_places=decimal_places, 

212 deprecated=deprecated, 

213 example=example, 

214 examples=examples, 

215 openapi_examples=openapi_examples, 

216 include_in_schema=include_in_schema, 

217 json_schema_extra=json_schema_extra, 

218 **extra, 

219 ) 

220 

221 

222class Query(Param): # type: ignore[misc] 1adbc

223 in_ = ParamTypes.query 1adbc

224 

225 def __init__( 1adbc

226 self, 

227 default: Any = Undefined, 

228 *, 

229 default_factory: Callable[[], Any] | None = _Unset, 

230 annotation: Any | None = None, 

231 alias: str | None = None, 

232 alias_priority: int | None = _Unset, 

233 validation_alias: str | AliasPath | AliasChoices | None = None, 

234 serialization_alias: str | None = None, 

235 title: str | None = None, 

236 description: str | None = None, 

237 gt: float | None = None, 

238 ge: float | None = None, 

239 lt: float | None = None, 

240 le: float | None = None, 

241 min_length: int | None = None, 

242 max_length: int | None = None, 

243 pattern: str | None = None, 

244 regex: Annotated[ 

245 str | None, 

246 deprecated( 

247 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

248 ), 

249 ] = None, 

250 discriminator: str | None = None, 

251 strict: bool | None = _Unset, 

252 multiple_of: float | None = _Unset, 

253 allow_inf_nan: bool | None = _Unset, 

254 max_digits: int | None = _Unset, 

255 decimal_places: int | None = _Unset, 

256 examples: list[Any] | None = None, 

257 example: Annotated[ 

258 Any | None, 

259 deprecated( 

260 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

261 "although still supported. Use examples instead." 

262 ), 

263 ] = _Unset, 

264 openapi_examples: dict[str, Example] | None = None, 

265 deprecated: deprecated | str | bool | None = None, 

266 include_in_schema: bool = True, 

267 json_schema_extra: dict[str, Any] | None = None, 

268 **extra: Any, 

269 ): 

270 super().__init__( 2a $c%b%c'c(c)c*c+c,c-c.c/c:c;c=c?c@c[c]c^c_c,b-b.b/b:bad;b=b?b@be f bdcdddedfdgdk G H I d hd[bidjdkdldmdndodpdqdrdsdtdudvdwdxdydzdAd|b}b~bacbcccdcecfcg h GdHdIdJdKdLdl K L M b c MdgcNdOdPdQdRdSdTdUdVdWdXdYdZd0d1d2d3d4d5dmcncocpcqc#drcsctcuci j $d%d'd(d)d*dm O P Q

271 default=default, 

272 default_factory=default_factory, 

273 annotation=annotation, 

274 alias=alias, 

275 alias_priority=alias_priority, 

276 validation_alias=validation_alias, 

277 serialization_alias=serialization_alias, 

278 title=title, 

279 description=description, 

280 gt=gt, 

281 ge=ge, 

282 lt=lt, 

283 le=le, 

284 min_length=min_length, 

285 max_length=max_length, 

286 pattern=pattern, 

287 regex=regex, 

288 discriminator=discriminator, 

289 strict=strict, 

290 multiple_of=multiple_of, 

291 allow_inf_nan=allow_inf_nan, 

292 max_digits=max_digits, 

293 decimal_places=decimal_places, 

294 deprecated=deprecated, 

295 example=example, 

296 examples=examples, 

297 openapi_examples=openapi_examples, 

298 include_in_schema=include_in_schema, 

299 json_schema_extra=json_schema_extra, 

300 **extra, 

301 ) 

302 

303 

304class Header(Param): # type: ignore[misc] 1adbc

305 in_ = ParamTypes.header 1adbc

306 

307 def __init__( 1adbc

308 self, 

309 default: Any = Undefined, 

310 *, 

311 default_factory: Callable[[], Any] | None = _Unset, 

312 annotation: Any | None = None, 

313 alias: str | None = None, 

314 alias_priority: int | None = _Unset, 

315 validation_alias: str | AliasPath | AliasChoices | None = None, 

316 serialization_alias: str | None = None, 

317 convert_underscores: bool = True, 

318 title: str | None = None, 

319 description: str | None = None, 

320 gt: float | None = None, 

321 ge: float | None = None, 

322 lt: float | None = None, 

323 le: float | None = None, 

324 min_length: int | None = None, 

325 max_length: int | None = None, 

326 pattern: str | None = None, 

327 regex: Annotated[ 

328 str | None, 

329 deprecated( 

330 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

331 ), 

332 ] = None, 

333 discriminator: str | None = None, 

334 strict: bool | None = _Unset, 

335 multiple_of: float | None = _Unset, 

336 allow_inf_nan: bool | None = _Unset, 

337 max_digits: int | None = _Unset, 

338 decimal_places: int | None = _Unset, 

339 examples: list[Any] | None = None, 

340 example: Annotated[ 

341 Any | None, 

342 deprecated( 

343 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

344 "although still supported. Use examples instead." 

345 ), 

346 ] = _Unset, 

347 openapi_examples: dict[str, Example] | None = None, 

348 deprecated: deprecated | str | bool | None = None, 

349 include_in_schema: bool = True, 

350 json_schema_extra: dict[str, Any] | None = None, 

351 **extra: Any, 

352 ): 

353 self.convert_underscores = convert_underscores 2a , - . / : e f d { | } ~ abg h b c kblbmbnbobi j

354 super().__init__( 2a , - . / : e f d { | } ~ abg h b c kblbmbnbobi j

355 default=default, 

356 default_factory=default_factory, 

357 annotation=annotation, 

358 alias=alias, 

359 alias_priority=alias_priority, 

360 validation_alias=validation_alias, 

361 serialization_alias=serialization_alias, 

362 title=title, 

363 description=description, 

364 gt=gt, 

365 ge=ge, 

366 lt=lt, 

367 le=le, 

368 min_length=min_length, 

369 max_length=max_length, 

370 pattern=pattern, 

371 regex=regex, 

372 discriminator=discriminator, 

373 strict=strict, 

374 multiple_of=multiple_of, 

375 allow_inf_nan=allow_inf_nan, 

376 max_digits=max_digits, 

377 decimal_places=decimal_places, 

378 deprecated=deprecated, 

379 example=example, 

380 examples=examples, 

381 openapi_examples=openapi_examples, 

382 include_in_schema=include_in_schema, 

383 json_schema_extra=json_schema_extra, 

384 **extra, 

385 ) 

386 

387 

388class Cookie(Param): # type: ignore[misc] 1adbc

389 in_ = ParamTypes.cookie 1adbc

390 

391 def __init__( 1adbc

392 self, 

393 default: Any = Undefined, 

394 *, 

395 default_factory: Callable[[], Any] | None = _Unset, 

396 annotation: Any | None = None, 

397 alias: str | None = None, 

398 alias_priority: int | None = _Unset, 

399 validation_alias: str | AliasPath | AliasChoices | None = None, 

400 serialization_alias: str | None = None, 

401 title: str | None = None, 

402 description: str | None = None, 

403 gt: float | None = None, 

404 ge: float | None = None, 

405 lt: float | None = None, 

406 le: float | None = None, 

407 min_length: int | None = None, 

408 max_length: int | None = None, 

409 pattern: str | None = None, 

410 regex: Annotated[ 

411 str | None, 

412 deprecated( 

413 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

414 ), 

415 ] = None, 

416 discriminator: str | None = None, 

417 strict: bool | None = _Unset, 

418 multiple_of: float | None = _Unset, 

419 allow_inf_nan: bool | None = _Unset, 

420 max_digits: int | None = _Unset, 

421 decimal_places: int | None = _Unset, 

422 examples: list[Any] | None = None, 

423 example: Annotated[ 

424 Any | None, 

425 deprecated( 

426 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

427 "although still supported. Use examples instead." 

428 ), 

429 ] = _Unset, 

430 openapi_examples: dict[str, Example] | None = None, 

431 deprecated: deprecated | str | bool | None = None, 

432 include_in_schema: bool = True, 

433 json_schema_extra: dict[str, Any] | None = None, 

434 **extra: Any, 

435 ): 

436 super().__init__( 2a 'b(b)b*b+be f d ]b^b_b`b{bg h b c hcicjckclci j

437 default=default, 

438 default_factory=default_factory, 

439 annotation=annotation, 

440 alias=alias, 

441 alias_priority=alias_priority, 

442 validation_alias=validation_alias, 

443 serialization_alias=serialization_alias, 

444 title=title, 

445 description=description, 

446 gt=gt, 

447 ge=ge, 

448 lt=lt, 

449 le=le, 

450 min_length=min_length, 

451 max_length=max_length, 

452 pattern=pattern, 

453 regex=regex, 

454 discriminator=discriminator, 

455 strict=strict, 

456 multiple_of=multiple_of, 

457 allow_inf_nan=allow_inf_nan, 

458 max_digits=max_digits, 

459 decimal_places=decimal_places, 

460 deprecated=deprecated, 

461 example=example, 

462 examples=examples, 

463 openapi_examples=openapi_examples, 

464 include_in_schema=include_in_schema, 

465 json_schema_extra=json_schema_extra, 

466 **extra, 

467 ) 

468 

469 

470class Body(FieldInfo): # type: ignore[misc] 1adbc

471 def __init__( 1adbc

472 self, 

473 default: Any = Undefined, 

474 *, 

475 default_factory: Callable[[], Any] | None = _Unset, 

476 annotation: Any | None = None, 

477 embed: bool | None = None, 

478 media_type: str = "application/json", 

479 alias: str | None = None, 

480 alias_priority: int | None = _Unset, 

481 validation_alias: str | AliasPath | AliasChoices | None = None, 

482 serialization_alias: str | None = None, 

483 title: str | None = None, 

484 description: str | None = None, 

485 gt: float | None = None, 

486 ge: float | None = None, 

487 lt: float | None = None, 

488 le: float | None = None, 

489 min_length: int | None = None, 

490 max_length: int | None = None, 

491 pattern: str | None = None, 

492 regex: Annotated[ 

493 str | None, 

494 deprecated( 

495 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

496 ), 

497 ] = None, 

498 discriminator: str | None = None, 

499 strict: bool | None = _Unset, 

500 multiple_of: float | None = _Unset, 

501 allow_inf_nan: bool | None = _Unset, 

502 max_digits: int | None = _Unset, 

503 decimal_places: int | None = _Unset, 

504 examples: list[Any] | None = None, 

505 example: Annotated[ 

506 Any | None, 

507 deprecated( 

508 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

509 "although still supported. Use examples instead." 

510 ), 

511 ] = _Unset, 

512 openapi_examples: dict[str, Example] | None = None, 

513 deprecated: deprecated | str | bool | None = None, 

514 include_in_schema: bool = True, 

515 json_schema_extra: dict[str, Any] | None = None, 

516 **extra: Any, 

517 ): 

518 self.embed = embed 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

519 self.media_type = media_type 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

520 if example is not _Unset: 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

521 warnings.warn( 1efghij

522 "`example` has been deprecated, please use `examples` instead", 

523 category=FastAPIDeprecationWarning, 

524 stacklevel=4, 

525 ) 

526 self.example = example 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

527 self.include_in_schema = include_in_schema 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

528 self.openapi_examples = openapi_examples 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

529 kwargs = dict( 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

530 default=default, 

531 default_factory=default_factory, 

532 alias=alias, 

533 title=title, 

534 description=description, 

535 gt=gt, 

536 ge=ge, 

537 lt=lt, 

538 le=le, 

539 min_length=min_length, 

540 max_length=max_length, 

541 discriminator=discriminator, 

542 multiple_of=multiple_of, 

543 allow_inf_nan=allow_inf_nan, 

544 max_digits=max_digits, 

545 decimal_places=decimal_places, 

546 **extra, 

547 ) 

548 if examples is not None: 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

549 kwargs["examples"] = examples 1aefdghbcij

550 if regex is not None: 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

551 warnings.warn( 1pqrsvwxyBCDE

552 "`regex` has been deprecated, please use `pattern` instead", 

553 category=FastAPIDeprecationWarning, 

554 stacklevel=4, 

555 ) 

556 current_json_schema_extra = json_schema_extra or extra 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

557 kwargs["deprecated"] = deprecated 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

558 if serialization_alias in (_Unset, None) and isinstance(alias, str): 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

559 serialization_alias = alias 2a n rbsbtbubvbwbxbo X p q r s d t HbIbJbKbLbMbNbu 4 v w x y b c z XbYbZb0b1b2b3bA # B C D E

560 if validation_alias in (_Unset, None): 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

561 validation_alias = alias 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

562 kwargs.update( 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

563 { 

564 "annotation": annotation, 

565 "alias_priority": alias_priority, 

566 "validation_alias": validation_alias, 

567 "serialization_alias": serialization_alias, 

568 "strict": strict, 

569 "json_schema_extra": current_json_schema_extra, 

570 } 

571 ) 

572 kwargs["pattern"] = pattern or regex 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

573 

574 use_kwargs = {k: v for k, v in kwargs.items() if v is not _Unset} 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

575 

576 super().__init__(**use_kwargs) 2a vcwcn rbsbtbubvbwbxbxco R S ybT zbAbU V W BbX yczcAcBcCcDcEcCbDbEbFbGbFcGcHcp q r s e f Ick Jcd KcLct HbIbJbKbLbMbNbMcu Y Z Ob0 PbQb1 2 3 Rb4 NcOcPcQcRcScTcSbTbUbVbWbUcv w x y g h Vcl Wcb c XcYcz XbYbZb0b1b2b3bZcA 5 6 4b7 5b6b8 9 ! 7b# 0c1c2c3c4c5c6c8b9b!b#b$b7c8c9cB C D E i j !cm #c

577 

578 def __repr__(self) -> str: 1adbc

579 return f"{self.__class__.__name__}({self.default})" 2CbDbEbFbGbSbTbUbVbWb8b9b!b#b$b

580 

581 

582class Form(Body): # type: ignore[misc] 1adbc

583 def __init__( 1adbc

584 self, 

585 default: Any = Undefined, 

586 *, 

587 default_factory: Callable[[], Any] | None = _Unset, 

588 annotation: Any | None = None, 

589 media_type: str = "application/x-www-form-urlencoded", 

590 alias: str | None = None, 

591 alias_priority: int | None = _Unset, 

592 validation_alias: str | AliasPath | AliasChoices | None = None, 

593 serialization_alias: str | None = None, 

594 title: str | None = None, 

595 description: str | None = None, 

596 gt: float | None = None, 

597 ge: float | None = None, 

598 lt: float | None = None, 

599 le: float | None = None, 

600 min_length: int | None = None, 

601 max_length: int | None = None, 

602 pattern: str | None = None, 

603 regex: Annotated[ 

604 str | None, 

605 deprecated( 

606 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

607 ), 

608 ] = None, 

609 discriminator: str | None = None, 

610 strict: bool | None = _Unset, 

611 multiple_of: float | None = _Unset, 

612 allow_inf_nan: bool | None = _Unset, 

613 max_digits: int | None = _Unset, 

614 decimal_places: int | None = _Unset, 

615 examples: list[Any] | None = None, 

616 example: Annotated[ 

617 Any | None, 

618 deprecated( 

619 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

620 "although still supported. Use examples instead." 

621 ), 

622 ] = _Unset, 

623 openapi_examples: dict[str, Example] | None = None, 

624 deprecated: deprecated | str | bool | None = None, 

625 include_in_schema: bool = True, 

626 json_schema_extra: dict[str, Any] | None = None, 

627 **extra: Any, 

628 ): 

629 super().__init__( 2a n o R S ybT zbAbU V W BbX p q r s d t u Y Z Ob0 PbQb1 2 3 Rb4 v w x y b c z A 5 6 4b7 5b6b8 9 ! 7b# B C D E

630 default=default, 

631 default_factory=default_factory, 

632 annotation=annotation, 

633 media_type=media_type, 

634 alias=alias, 

635 alias_priority=alias_priority, 

636 validation_alias=validation_alias, 

637 serialization_alias=serialization_alias, 

638 title=title, 

639 description=description, 

640 gt=gt, 

641 ge=ge, 

642 lt=lt, 

643 le=le, 

644 min_length=min_length, 

645 max_length=max_length, 

646 pattern=pattern, 

647 regex=regex, 

648 discriminator=discriminator, 

649 strict=strict, 

650 multiple_of=multiple_of, 

651 allow_inf_nan=allow_inf_nan, 

652 max_digits=max_digits, 

653 decimal_places=decimal_places, 

654 deprecated=deprecated, 

655 example=example, 

656 examples=examples, 

657 openapi_examples=openapi_examples, 

658 include_in_schema=include_in_schema, 

659 json_schema_extra=json_schema_extra, 

660 **extra, 

661 ) 

662 

663 

664class File(Form): # type: ignore[misc] 1adbc

665 def __init__( 1adbc

666 self, 

667 default: Any = Undefined, 

668 *, 

669 default_factory: Callable[[], Any] | None = _Unset, 

670 annotation: Any | None = None, 

671 media_type: str = "multipart/form-data", 

672 alias: str | None = None, 

673 alias_priority: int | None = _Unset, 

674 validation_alias: str | AliasPath | AliasChoices | None = None, 

675 serialization_alias: str | None = None, 

676 title: str | None = None, 

677 description: str | None = None, 

678 gt: float | None = None, 

679 ge: float | None = None, 

680 lt: float | None = None, 

681 le: float | None = None, 

682 min_length: int | None = None, 

683 max_length: int | None = None, 

684 pattern: str | None = None, 

685 regex: Annotated[ 

686 str | None, 

687 deprecated( 

688 "Deprecated in FastAPI 0.100.0 and Pydantic v2, use `pattern` instead." 

689 ), 

690 ] = None, 

691 discriminator: str | None = None, 

692 strict: bool | None = _Unset, 

693 multiple_of: float | None = _Unset, 

694 allow_inf_nan: bool | None = _Unset, 

695 max_digits: int | None = _Unset, 

696 decimal_places: int | None = _Unset, 

697 examples: list[Any] | None = None, 

698 example: Annotated[ 

699 Any | None, 

700 deprecated( 

701 "Deprecated in OpenAPI 3.1.0 that now uses JSON Schema 2020-12, " 

702 "although still supported. Use examples instead." 

703 ), 

704 ] = _Unset, 

705 openapi_examples: dict[str, Example] | None = None, 

706 deprecated: deprecated | str | bool | None = None, 

707 include_in_schema: bool = True, 

708 json_schema_extra: dict[str, Any] | None = None, 

709 **extra: Any, 

710 ): 

711 super().__init__( 1anoRSTUVWdtuYZ0123bczA56789!

712 default=default, 

713 default_factory=default_factory, 

714 annotation=annotation, 

715 media_type=media_type, 

716 alias=alias, 

717 alias_priority=alias_priority, 

718 validation_alias=validation_alias, 

719 serialization_alias=serialization_alias, 

720 title=title, 

721 description=description, 

722 gt=gt, 

723 ge=ge, 

724 lt=lt, 

725 le=le, 

726 min_length=min_length, 

727 max_length=max_length, 

728 pattern=pattern, 

729 regex=regex, 

730 discriminator=discriminator, 

731 strict=strict, 

732 multiple_of=multiple_of, 

733 allow_inf_nan=allow_inf_nan, 

734 max_digits=max_digits, 

735 decimal_places=decimal_places, 

736 deprecated=deprecated, 

737 example=example, 

738 examples=examples, 

739 openapi_examples=openapi_examples, 

740 include_in_schema=include_in_schema, 

741 json_schema_extra=json_schema_extra, 

742 **extra, 

743 ) 

744 

745 

746@dataclass(frozen=True) 1adbc

747class Depends: 1adbc

748 dependency: Callable[..., Any] | None = None 1adbc

749 use_cache: bool = True 1adbc

750 scope: Literal["function", "request"] | None = None 1adbc

751 

752 

753@dataclass(frozen=True) 1adbc

754class Security(Depends): 1adbc

755 scopes: Sequence[str] | None = None 1adbc