1010router = ModuleRouter ("" )
1111
1212
13- @router .Get ("/root" )
13+ @router .get ("/root" )
1414def non_operation ():
1515 return {"message" : "Hello World" }
1616
1717
18- @router .Get ("/text" )
18+ @router .get ("/text" )
1919def get_text ():
2020 return "Hello World"
2121
2222
23- @router .Get ("/path/{item_id}" )
23+ @router .get ("/path/{item_id}" )
2424def get_id (item_id ):
2525 return item_id
2626
2727
28- @router .Get ("/path/str/{item_id}" )
28+ @router .get ("/path/str/{item_id}" )
2929def get_str_id (item_id : str ):
3030 return item_id
3131
3232
33- @router .Get ("/path/int/{item_id}" )
33+ @router .get ("/path/int/{item_id}" )
3434def get_int_id (item_id : int ):
3535 return item_id
3636
3737
38- @router .Get ("/path/float/{item_id}" )
38+ @router .get ("/path/float/{item_id}" )
3939def get_float_id (item_id : float ):
4040 return item_id
4141
4242
43- @router .Get ("/path/bool/{item_id}" )
43+ @router .get ("/path/bool/{item_id}" )
4444def get_bool_id (item_id : bool ):
4545 return item_id
4646
4747
48- @router .Get ("/path/param/{item_id}" )
48+ @router .get ("/path/param/{item_id}" )
4949def get_path_param_id (item_id : Optional [str ] = Path (None )):
5050 return item_id
5151
5252
53- @router .Get ("/path/param-required/{item_id}" )
53+ @router .get ("/path/param-required/{item_id}" )
5454def get_path_param_required_id (item_id : str = Path (...)):
5555 return item_id
5656
5757
58- @router .Get ("/path/param-minlength/{item_id}" )
58+ @router .get ("/path/param-minlength/{item_id}" )
5959def get_path_param_min_length (item_id : str = Path (..., min_length = 3 )):
6060 return item_id
6161
6262
63- @router .Get ("/path/param-maxlength/{item_id}" )
63+ @router .get ("/path/param-maxlength/{item_id}" )
6464def get_path_param_max_length (item_id : str = Path (..., max_length = 3 )):
6565 return item_id
6666
6767
68- @router .Get ("/path/param-min_maxlength/{item_id}" )
68+ @router .get ("/path/param-min_maxlength/{item_id}" )
6969def get_path_param_min_max_length (item_id : str = Path (..., max_length = 3 , min_length = 2 )):
7070 return item_id
7171
7272
73- @router .Get ("/path/param-gt/{item_id}" )
73+ @router .get ("/path/param-gt/{item_id}" )
7474def get_path_param_gt (item_id : float = Path (..., gt = 3 )):
7575 return item_id
7676
7777
78- @router .Get ("/path/param-gt0/{item_id}" )
78+ @router .get ("/path/param-gt0/{item_id}" )
7979def get_path_param_gt0 (item_id : float = Path (..., gt = 0 )):
8080 return item_id
8181
8282
83- @router .Get ("/path/param-ge/{item_id}" )
83+ @router .get ("/path/param-ge/{item_id}" )
8484def get_path_param_ge (item_id : float = Path (..., ge = 3 )):
8585 return item_id
8686
8787
88- @router .Get ("/path/param-lt/{item_id}" )
88+ @router .get ("/path/param-lt/{item_id}" )
8989def get_path_param_lt (item_id : float = Path (..., lt = 3 )):
9090 return item_id
9191
9292
93- @router .Get ("/path/param-lt0/{item_id}" )
93+ @router .get ("/path/param-lt0/{item_id}" )
9494def get_path_param_lt0 (item_id : float = Path (..., lt = 0 )):
9595 return item_id
9696
9797
98- @router .Get ("/path/param-le/{item_id}" )
98+ @router .get ("/path/param-le/{item_id}" )
9999def get_path_param_le (item_id : float = Path (..., le = 3 )):
100100 return item_id
101101
102102
103- @router .Get ("/path/param-lt-gt/{item_id}" )
103+ @router .get ("/path/param-lt-gt/{item_id}" )
104104def get_path_param_lt_gt (item_id : float = Path (..., lt = 3 , gt = 1 )):
105105 return item_id
106106
107107
108- @router .Get ("/path/param-le-ge/{item_id}" )
108+ @router .get ("/path/param-le-ge/{item_id}" )
109109def get_path_param_le_ge (item_id : float = Path (..., le = 3 , ge = 1 )):
110110 return item_id
111111
112112
113- @router .Get ("/path/param-lt-int/{item_id}" )
113+ @router .get ("/path/param-lt-int/{item_id}" )
114114def get_path_param_lt_int (item_id : int = Path (..., lt = 3 )):
115115 return item_id
116116
117117
118- @router .Get ("/path/param-gt-int/{item_id}" )
118+ @router .get ("/path/param-gt-int/{item_id}" )
119119def get_path_param_gt_int (item_id : int = Path (..., gt = 3 )):
120120 return item_id
121121
122122
123- @router .Get ("/path/param-le-int/{item_id}" )
123+ @router .get ("/path/param-le-int/{item_id}" )
124124def get_path_param_le_int (item_id : int = Path (..., le = 3 )):
125125 return item_id
126126
127127
128- @router .Get ("/path/param-ge-int/{item_id}" )
128+ @router .get ("/path/param-ge-int/{item_id}" )
129129def get_path_param_ge_int (item_id : int = Path (..., ge = 3 )):
130130 return item_id
131131
132132
133- @router .Get ("/path/param-lt-gt-int/{item_id}" )
133+ @router .get ("/path/param-lt-gt-int/{item_id}" )
134134def get_path_param_lt_gt_int (item_id : int = Path (..., lt = 3 , gt = 1 )):
135135 return item_id
136136
137137
138- @router .Get ("/path/param-le-ge-int/{item_id}" )
138+ @router .get ("/path/param-le-ge-int/{item_id}" )
139139def get_path_param_le_ge_int (item_id : int = Path (..., le = 3 , ge = 1 )):
140140 return item_id
141141
142142
143- @router .Get ("/path/param-starlette-str/{item_id:str}" )
143+ @router .get ("/path/param-starlette-str/{item_id:str}" )
144144def get_path_param_starlette_str (item_id ):
145145 return item_id
146146
147147
148- @router .Get ("/path/param-starlette-int/{item_id:int}" )
148+ @router .get ("/path/param-starlette-int/{item_id:int}" )
149149def get_path_param_starlette_int (item_id : int ):
150150 assert isinstance (item_id , int )
151151 return item_id
152152
153153
154- @router .Get ("/path/param-starlette-int-str/{item_id:int}" )
154+ @router .get ("/path/param-starlette-int-str/{item_id:int}" )
155155def get_path_param_starlette_int_str (item_id : str ):
156156 assert isinstance (item_id , str )
157157 return item_id
158158
159159
160- @router .Get ("/path/param-starlette-uuid/{item_id:uuid}" )
160+ @router .get ("/path/param-starlette-uuid/{item_id:uuid}" )
161161def get_path_param_starlette_uuid (item_id : UUID ):
162162 assert isinstance (item_id , UUID )
163163 return item_id
164164
165165
166- @router .Get ("/query" )
166+ @router .get ("/query" )
167167def get_query (query ):
168168 return f"foo bar { query } "
169169
170170
171- @router .Get ("/query/optional" )
171+ @router .get ("/query/optional" )
172172def get_query_optional (query = None ):
173173 if query is None :
174174 return "foo bar"
175175 return f"foo bar { query } "
176176
177177
178- @router .Get ("/query/int" )
178+ @router .get ("/query/int" )
179179def get_query_type (query : int ):
180180 return f"foo bar { query } "
181181
182182
183- @router .Get ("/query/int/optional" )
183+ @router .get ("/query/int/optional" )
184184def get_query_type_optional (query : int = None ):
185185 if query is None :
186186 return "foo bar"
187187 return f"foo bar { query } "
188188
189189
190- @router .Get ("/query/int/default" )
190+ @router .get ("/query/int/default" )
191191def get_query_type_optional_10 (query : int = 10 ):
192192 return f"foo bar { query } "
193193
194194
195- @router .Get ("/query/param-required" )
195+ @router .get ("/query/param-required" )
196196def get_query_param_required (query = Query (...)):
197197 assert isinstance (query , str )
198198 return f"foo bar { query } "
199199
200200
201- @router .Get ("/query/param-required/int" )
201+ @router .get ("/query/param-required/int" )
202202def get_query_param_required_type (query : int = Query (...)):
203203 assert isinstance (query , int )
204204 return f"foo bar { query } "
@@ -208,12 +208,12 @@ class AliasedSchema(Schema):
208208 query : str = Field (..., alias = "aliased.-_~name" )
209209
210210
211- @router .Get ("/query/aliased-name" )
211+ @router .get ("/query/aliased-name" )
212212def get_query_aliased_name (query : AliasedSchema = Query (..., alias = "aliased.-_~name" )):
213213 return f"foo bar { query .query } "
214214
215215
216- @router .Get ("/query/param" )
216+ @router .get ("/query/param" )
217217def get_query_param (request , query = Query (None )):
218218 if query is None :
219219 return "foo bar"
0 commit comments