forked from koxudaxi/fastapi-code-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request koxudaxi#375 from yyamano/issue-222
Generate an empty model file if an api spec file have no "schemas".
- Loading branch information
Showing
5 changed files
with
53 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
tests/data/expected/openapi/default_template/no_models/main.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# generated by fastapi-codegen: | ||
# filename: no_models.yaml | ||
# timestamp: 2020-06-19T00:00:00+00:00 | ||
|
||
from __future__ import annotations | ||
|
||
from fastapi import FastAPI | ||
|
||
app = FastAPI( | ||
version='1.0.0', | ||
title='Swagger Petstore', | ||
license={'name': 'MIT'}, | ||
description=None, | ||
servers=[{'url': 'http://petstore.swagger.io/v1'}], | ||
) | ||
|
||
|
||
@app.get('/hello', response_model=str) | ||
def hello() -> str: | ||
""" | ||
get hello message | ||
""" | ||
pass |
3 changes: 3 additions & 0 deletions
3
tests/data/expected/openapi/default_template/no_models/models.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# generated by fastapi-codegen: | ||
# filename: no_models.yaml | ||
# timestamp: 2020-06-19T00:00:00+00:00 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
openapi: "3.0.0" | ||
info: | ||
version: 1.0.0 | ||
title: Swagger Petstore | ||
license: | ||
name: MIT | ||
description: | ||
|
||
servers: | ||
- url: http://petstore.swagger.io/v1 | ||
paths: | ||
/hello: | ||
get: | ||
summary: get hello message | ||
operationId: hello | ||
responses: | ||
'200': | ||
description: message string | ||
content: | ||
text/plain: | ||
schema: | ||
type: string |