Skip to content

Commit 1b64de2

Browse files
committed
Add test.
1 parent 97c796b commit 1b64de2

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

tests/data/expected/openapi/default_template/body_and_parameters/main.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,12 @@ def post_bar(request: Request) -> None:
3737

3838

3939
@app.post('/convert', response_model=bytes)
40-
def convert(format: Optional[str] = 'pdf', request: Request = ...) -> bytes:
40+
def convert1(format: Optional[str] = 'pdf', request: Request = ...) -> bytes:
41+
pass
42+
43+
44+
@app.put('/convert', response_model=bytes)
45+
def convert2(format: Optional[str] = None, request: Request = ...) -> bytes:
4146
pass
4247

4348

tests/data/openapi/default_template/body_and_parameters.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,8 @@ paths:
339339
required: true
340340
/convert:
341341
post:
342-
operationId: convert
342+
description: https://github.com/koxudaxi/fastapi-code-generator/issues/376
343+
operationId: convert1
343344
parameters:
344345
- in: query
345346
name: format
@@ -360,6 +361,28 @@ paths:
360361
schema:
361362
type: string
362363
format: binary
364+
put:
365+
description: https://github.com/koxudaxi/fastapi-code-generator/issues/322
366+
operationId: convert2
367+
parameters:
368+
- in: query
369+
name: format
370+
schema:
371+
type: string
372+
requestBody:
373+
required: true
374+
content:
375+
application/octet-stream:
376+
schema:
377+
type: string
378+
format: binary
379+
responses:
380+
"200":
381+
content:
382+
application/octet-stream:
383+
schema:
384+
type: string
385+
format: binary
363386
components:
364387
parameters:
365388
MyParam:

0 commit comments

Comments
 (0)