Skip to content

Commit c4c6366

Browse files
committed
Add generated newlines
1 parent 63a2d8a commit c4c6366

4 files changed

Lines changed: 54 additions & 27 deletions

File tree

samples/server/petstore/python-fastapi/src/openapi_server/apis/fake_api.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,10 @@
4646
response_model_by_alias=True,
4747
)
4848
async def fake_query_param_default(
49-
has_default: Annotated[Optional[StrictStr], Field(description="has default value")] = Query('Hello World', description="has default value", alias="hasDefault"),
50-
no_default: Annotated[Optional[StrictStr], Field(description="no default value")] = Query(None, description="no default value", alias="noDefault"),
49+
has_default: Annotated[Optional[StrictStr], Field(description="has default value")] = Query('Hello World', description="has default value", alias="hasDefault")
50+
,
51+
no_default: Annotated[Optional[StrictStr], Field(description="no default value")] = Query(None, description="no default value", alias="noDefault")
52+
,
5153
) -> None:
5254
""""""
5355
if not BaseFakeApi.subclasses:

samples/server/petstore/python-fastapi/src/openapi_server/apis/pet_api.py

Lines changed: 26 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@
5050
response_model_by_alias=True,
5151
)
5252
async def update_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"),
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+
,
5455
token_petstore_auth: TokenModel = Security(
5556
get_token_petstore_auth, scopes=["write:pets", "read:pets"]
5657
),
@@ -72,7 +73,8 @@ async def update_pet(
7273
response_model_by_alias=True,
7374
)
7475
async def add_pet(
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"),
76+
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+
,
7678
token_petstore_auth: TokenModel = Security(
7779
get_token_petstore_auth, scopes=["write:pets", "read:pets"]
7880
),
@@ -94,7 +96,8 @@ async def add_pet(
9496
response_model_by_alias=True,
9597
)
9698
async def find_pets_by_status(
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"),
99+
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+
,
98101
token_petstore_auth: TokenModel = Security(
99102
get_token_petstore_auth, scopes=["read:pets"]
100103
),
@@ -116,7 +119,8 @@ async def find_pets_by_status(
116119
response_model_by_alias=True,
117120
)
118121
async def find_pets_by_tags(
119-
tags: Annotated[List[StrictStr], Field(description="Tags to filter by")] = Query(..., description="Tags to filter by", alias="tags"),
122+
tags: Annotated[List[StrictStr], Field(description="Tags to filter by")] = Query(..., description="Tags to filter by", alias="tags")
123+
,
120124
token_petstore_auth: TokenModel = Security(
121125
get_token_petstore_auth, scopes=["read:pets"]
122126
),
@@ -139,7 +143,8 @@ async def find_pets_by_tags(
139143
response_model_by_alias=True,
140144
)
141145
async def get_pet_by_id(
142-
petId: Annotated[StrictInt, Field(description="ID of pet to return")] = Path(..., description="ID of pet to return"),
146+
petId: Annotated[StrictInt, Field(description="ID of pet to return")] = Path(..., description="ID of pet to return")
147+
,
143148
token_api_key: TokenModel = Security(
144149
get_token_api_key
145150
),
@@ -160,9 +165,12 @@ async def get_pet_by_id(
160165
response_model_by_alias=True,
161166
)
162167
async def update_pet_with_form(
163-
petId: Annotated[StrictInt, Field(description="ID of pet that needs to be updated")] = Path(..., description="ID of pet that needs to be updated"),
164-
name: Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = Form(None, description="Updated name of the pet"),
165-
status: Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = Form(None, description="Updated status of the pet"),
168+
petId: Annotated[StrictInt, Field(description="ID of pet that needs to be updated")] = Path(..., description="ID of pet that needs to be updated")
169+
,
170+
name: Annotated[Optional[StrictStr], Field(description="Updated name of the pet")] = Form(None, description="Updated name of the pet")
171+
,
172+
status: Annotated[Optional[StrictStr], Field(description="Updated status of the pet")] = Form(None, description="Updated status of the pet")
173+
,
166174
token_petstore_auth: TokenModel = Security(
167175
get_token_petstore_auth, scopes=["write:pets", "read:pets"]
168176
),
@@ -183,8 +191,10 @@ async def update_pet_with_form(
183191
response_model_by_alias=True,
184192
)
185193
async def delete_pet(
186-
petId: Annotated[StrictInt, Field(description="Pet id to delete")] = Path(..., description="Pet id to delete"),
187-
api_key: Optional[StrictStr] = Header(None, description=""),
194+
petId: Annotated[StrictInt, Field(description="Pet id to delete")] = Path(..., description="Pet id to delete")
195+
,
196+
api_key: Optional[StrictStr] = Header(None, description="")
197+
,
188198
token_petstore_auth: TokenModel = Security(
189199
get_token_petstore_auth, scopes=["write:pets", "read:pets"]
190200
),
@@ -205,9 +215,12 @@ async def delete_pet(
205215
response_model_by_alias=True,
206216
)
207217
async def upload_file(
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"),
218+
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+
,
211224
token_petstore_auth: TokenModel = Security(
212225
get_token_petstore_auth, scopes=["write:pets", "read:pets"]
213226
),

samples/server/petstore/python-fastapi/src/openapi_server/apis/store_api.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,8 @@ async def get_inventory(
6767
response_model_by_alias=True,
6868
)
6969
async def place_order(
70-
order: Annotated[Order, Field(description="order placed for purchasing the pet")] = Body(..., description="order placed for purchasing the pet"),
70+
order: Annotated[Order, Field(description="order placed for purchasing the pet")] = Body(..., description="order placed for purchasing the pet")
71+
,
7172
) -> Order:
7273
""""""
7374
if not BaseStoreApi.subclasses:
@@ -87,7 +88,8 @@ async def place_order(
8788
response_model_by_alias=True,
8889
)
8990
async def get_order_by_id(
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),
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+
,
9193
) -> Order:
9294
"""For valid response try integer IDs with value <= 5 or > 10. Other values will generate exceptions"""
9395
if not BaseStoreApi.subclasses:
@@ -106,7 +108,8 @@ async def get_order_by_id(
106108
response_model_by_alias=True,
107109
)
108110
async def delete_order(
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"),
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+
,
110113
) -> None:
111114
"""For valid response try integer IDs with value < 1000. Anything above 1000 or nonintegers will generate API errors"""
112115
if not BaseStoreApi.subclasses:

samples/server/petstore/python-fastapi/src/openapi_server/apis/user_api.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646
response_model_by_alias=True,
4747
)
4848
async def create_user(
49-
user: Annotated[User, Field(description="Created user object")] = Body(..., description="Created user object"),
49+
user: Annotated[User, Field(description="Created user object")] = Body(..., description="Created user object")
50+
,
5051
token_api_key: TokenModel = Security(
5152
get_token_api_key
5253
),
@@ -67,7 +68,8 @@ async def create_user(
6768
response_model_by_alias=True,
6869
)
6970
async def create_users_with_array_input(
70-
user: Annotated[List[User], Field(description="List of user object")] = Body(..., description="List of user object"),
71+
user: Annotated[List[User], Field(description="List of user object")] = Body(..., description="List of user object")
72+
,
7173
token_api_key: TokenModel = Security(
7274
get_token_api_key
7375
),
@@ -88,7 +90,8 @@ async def create_users_with_array_input(
8890
response_model_by_alias=True,
8991
)
9092
async def create_users_with_list_input(
91-
user: Annotated[List[User], Field(description="List of user object")] = Body(..., description="List of user object"),
93+
user: Annotated[List[User], Field(description="List of user object")] = Body(..., description="List of user object")
94+
,
9295
token_api_key: TokenModel = Security(
9396
get_token_api_key
9497
),
@@ -110,8 +113,10 @@ async def create_users_with_list_input(
110113
response_model_by_alias=True,
111114
)
112115
async def login_user(
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"),
116+
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+
,
115120
) -> str:
116121
""""""
117122
if not BaseUserApi.subclasses:
@@ -151,7 +156,8 @@ async def logout_user(
151156
response_model_by_alias=True,
152157
)
153158
async def get_user_by_name(
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."),
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+
,
155161
) -> User:
156162
""""""
157163
if not BaseUserApi.subclasses:
@@ -170,8 +176,10 @@ async def get_user_by_name(
170176
response_model_by_alias=True,
171177
)
172178
async def update_user(
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"),
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+
,
175183
token_api_key: TokenModel = Security(
176184
get_token_api_key
177185
),
@@ -193,7 +201,8 @@ async def update_user(
193201
response_model_by_alias=True,
194202
)
195203
async def delete_user(
196-
username: Annotated[StrictStr, Field(description="The name that needs to be deleted")] = Path(..., description="The name that needs to be deleted"),
204+
username: Annotated[StrictStr, Field(description="The name that needs to be deleted")] = Path(..., description="The name that needs to be deleted")
205+
,
197206
token_api_key: TokenModel = Security(
198207
get_token_api_key
199208
),

0 commit comments

Comments
 (0)