You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: modules/openapi-generator/src/test/java/org/openapitools/codegen/python/PythonFastAPIServerCodegenTest.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -71,7 +71,7 @@ public void testRequestBodyExampleInBodyMetadata() throws IOException {
assertFileContains(p, "user: Annotated[List[User], Field(description=\"List of user object\")] = Body(None, description=\"List of user object\", examples=[[{\"username\": \"foo\"}, {\"username\": \"bar\"}]])");
74
+
assertFileContains(p, "user: Annotated[List[User], Field(description=\"List of user object\")] = Body(..., description=\"List of user object\", examples=[[{\"username\": \"foo\"}, {\"username\": \"bar\"}]])");
Copy file name to clipboardExpand all lines: samples/server/petstore/python-fastapi/src/openapi_server/apis/pet_api.py
+13-26Lines changed: 13 additions & 26 deletions
Original file line number
Diff line number
Diff line change
@@ -50,8 +50,7 @@
50
50
response_model_by_alias=True,
51
51
)
52
52
asyncdefupdate_pet(
53
-
pet: Annotated[Pet, Field(description="Pet object that needs to be added to the store")] =Body(..., description="Pet object that needs to be added to the store")
54
-
,
53
+
pet: Annotated[Pet, Field(description="Pet object that needs to be added to the store")] =Body(..., description="Pet object that needs to be added to the store"),
pet: Annotated[Pet, Field(description="Pet object that needs to be added to the store")] =Body(..., description="Pet object that needs to be added to the store")
77
-
,
75
+
pet: Annotated[Pet, Field(description="Pet object that needs to be added to the store")] =Body(..., description="Pet object that needs to be added to the store"),
status: Annotated[List[StrictStr], Field(description="Status values that need to be considered for filter")] =Query(..., description="Status values that need to be considered for filter", alias="status")
100
-
,
97
+
status: Annotated[List[StrictStr], Field(description="Status values that need to be considered for filter")] =Query(..., description="Status values that need to be considered for filter", alias="status"),
petId: Annotated[StrictInt, Field(description="ID of pet to update")] =Path(..., description="ID of pet to update")
219
-
,
220
-
additional_metadata: Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] =Form(None, description="Additional data to pass to server")
221
-
,
222
-
file: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="file to upload")] =Form(None, description="file to upload")
223
-
,
208
+
petId: Annotated[StrictInt, Field(description="ID of pet to update")] =Path(..., description="ID of pet to update"),
209
+
additional_metadata: Annotated[Optional[StrictStr], Field(description="Additional data to pass to server")] =Form(None, description="Additional data to pass to server"),
210
+
file: Annotated[Optional[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]]], Field(description="file to upload")] =Form(None, description="file to upload"),
Copy file name to clipboardExpand all lines: samples/server/petstore/python-fastapi/src/openapi_server/apis/store_api.py
+3-6Lines changed: 3 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -67,8 +67,7 @@ async def get_inventory(
67
67
response_model_by_alias=True,
68
68
)
69
69
asyncdefplace_order(
70
-
order: Annotated[Order, Field(description="order placed for purchasing the pet")] =Body(..., description="order placed for purchasing the pet")
71
-
,
70
+
order: Annotated[Order, Field(description="order placed for purchasing the pet")] =Body(..., description="order placed for purchasing the pet"),
72
71
) ->Order:
73
72
""""""
74
73
ifnotBaseStoreApi.subclasses:
@@ -88,8 +87,7 @@ async def place_order(
88
87
response_model_by_alias=True,
89
88
)
90
89
asyncdefget_order_by_id(
91
-
orderId: Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")] =Path(..., description="ID of pet that needs to be fetched", ge=1, le=5)
92
-
,
90
+
orderId: Annotated[int, Field(le=5, strict=True, ge=1, description="ID of pet that needs to be fetched")] =Path(..., description="ID of pet that needs to be fetched", ge=1, le=5),
93
91
) ->Order:
94
92
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions"""
95
93
ifnotBaseStoreApi.subclasses:
@@ -108,8 +106,7 @@ async def get_order_by_id(
108
106
response_model_by_alias=True,
109
107
)
110
108
asyncdefdelete_order(
111
-
orderId: Annotated[StrictStr, Field(description="ID of the order that needs to be deleted")] =Path(..., description="ID of the order that needs to be deleted")
112
-
,
109
+
orderId: Annotated[StrictStr, Field(description="ID of the order that needs to be deleted")] =Path(..., description="ID of the order that needs to be deleted"),
113
110
) ->None:
114
111
"""For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"""
username: Annotated[str, Field(strict=True, description="The user name for login")] =Query(..., description="The user name for login", alias="username", regex=r"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$")
117
-
,
118
-
password: Annotated[StrictStr, Field(description="The password for login in clear text")] =Query(..., description="The password for login in clear text", alias="password")
119
-
,
113
+
username: Annotated[str, Field(strict=True, description="The user name for login")] =Query(..., description="The user name for login", alias="username", regex=r"^[a-zA-Z0-9]+[a-zA-Z0-9\.\-_]*[a-zA-Z0-9]+$"),
114
+
password: Annotated[StrictStr, Field(description="The password for login in clear text")] =Query(..., description="The password for login in clear text", alias="password"),
120
115
) ->str:
121
116
""""""
122
117
ifnotBaseUserApi.subclasses:
@@ -156,8 +151,7 @@ async def logout_user(
156
151
response_model_by_alias=True,
157
152
)
158
153
asyncdefget_user_by_name(
159
-
username: Annotated[StrictStr, Field(description="The name that needs to be fetched. Use user1 for testing.")] =Path(..., description="The name that needs to be fetched. Use user1 for testing.")
160
-
,
154
+
username: Annotated[StrictStr, Field(description="The name that needs to be fetched. Use user1 for testing.")] =Path(..., description="The name that needs to be fetched. Use user1 for testing."),
161
155
) ->User:
162
156
""""""
163
157
ifnotBaseUserApi.subclasses:
@@ -176,10 +170,8 @@ async def get_user_by_name(
176
170
response_model_by_alias=True,
177
171
)
178
172
asyncdefupdate_user(
179
-
username: Annotated[StrictStr, Field(description="name that need to be deleted")] =Path(..., description="name that need to be deleted")
180
-
,
181
-
user: Annotated[User, Field(description="Updated user object")] =Body(..., description="Updated user object")
182
-
,
173
+
username: Annotated[StrictStr, Field(description="name that need to be deleted")] =Path(..., description="name that need to be deleted"),
174
+
user: Annotated[User, Field(description="Updated user object")] =Body(..., description="Updated user object"),
183
175
token_api_key: TokenModel=Security(
184
176
get_token_api_key
185
177
),
@@ -201,8 +193,7 @@ async def update_user(
201
193
response_model_by_alias=True,
202
194
)
203
195
asyncdefdelete_user(
204
-
username: Annotated[StrictStr, Field(description="The name that needs to be deleted")] =Path(..., description="The name that needs to be deleted")
205
-
,
196
+
username: Annotated[StrictStr, Field(description="The name that needs to be deleted")] =Path(..., description="The name that needs to be deleted"),
0 commit comments