-
-
Notifications
You must be signed in to change notification settings - Fork 78
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add scalar openapi ui, update swagger version to 5 (#369)
* feat: add scalar openapi ui, update swagger version to 5 Signed-off-by: Keming <kemingy94@gmail.com> * fix lint Signed-off-by: Keming <kemingy94@gmail.com> * make mypy happy Signed-off-by: Keming <kemingy94@gmail.com> --------- Signed-off-by: Keming <kemingy94@gmail.com>
- Loading branch information
Showing
7 changed files
with
71 additions
and
34 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
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,25 @@ | ||
from flask import Flask, jsonify | ||
from flask.views import MethodView | ||
from pydantic import BaseModel | ||
|
||
from spectree import SpecTree | ||
|
||
app = Flask(__name__) | ||
spec = SpecTree("flask", annotations=True) | ||
|
||
|
||
class User(BaseModel): | ||
name: str | ||
token: str | ||
|
||
|
||
class Login(MethodView): | ||
@spec.validate() | ||
def post(self, json: User): | ||
print(json) | ||
return jsonify({"msg": "success"}) | ||
|
||
|
||
if __name__ == "__main__": | ||
app.add_url_rule("/login", view_func=Login.as_view("login")) | ||
app.run(debug=True) |
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
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