From 48e28369b5bf15ba7229b1f5f45ab6651790d8c9 Mon Sep 17 00:00:00 2001 From: Chuan-Heng Hsiao Date: Mon, 20 May 2024 20:17:23 -0400 Subject: [PATCH] update token-user in apidoc --- apidoc/addsecurity.py | 2 +- apidoc/apidoc.py | 6 ++++-- apidoc/attempt_register_user.yaml | 3 ++- apidoc/create_rank.yaml | 3 ++- apidoc/cross_post.yaml | 3 ++- apidoc/delete_articles.yaml | 3 ++- apidoc/delete_comments.yaml | 3 ++- apidoc/delete_favorite.yaml | 3 ++- apidoc/edit_article.yaml | 3 ++- apidoc/template.yaml | 1 + apidoc/yamltojson.py | 6 +++--- 11 files changed, 23 insertions(+), 13 deletions(-) diff --git a/apidoc/addsecurity.py b/apidoc/addsecurity.py index 868071e2..b81ff3c8 100755 --- a/apidoc/addsecurity.py +++ b/apidoc/addsecurity.py @@ -9,7 +9,7 @@ filename = sys.argv[1] with open(filename, 'r') as f: - the_struct = yaml.load(f) + the_struct = yaml.full_load(f) components = the_struct.get('components', {}) components['securitySchemes'] = { diff --git a/apidoc/apidoc.py b/apidoc/apidoc.py index 6e42188f..869f19e6 100644 --- a/apidoc/apidoc.py +++ b/apidoc/apidoc.py @@ -23,7 +23,7 @@ def _with_app_prefix(path): with open('apidoc/template.json', 'r') as f: - template = yaml.load(f) + template = yaml.full_load(f) @app.route('/') @@ -106,6 +106,7 @@ def _load_favorite_boards(user_id): """ return '' + @app.route(_with_app_prefix('/user//favorites/addboard'), methods=['POST']) def _add_favorite_board(user_id): """ @@ -467,10 +468,11 @@ def _get_verion(): """ return '' + @app.route(_with_app_prefix('/uservisitcount'), methods=['GET']) def _get_user_visit_count(): """ swagger_from_file: apidoc/get_user_visit_count.yaml """ - return '' \ No newline at end of file + return '' diff --git a/apidoc/attempt_register_user.yaml b/apidoc/attempt_register_user.yaml index 36a1522d..853fadae 100644 --- a/apidoc/attempt_register_user.yaml +++ b/apidoc/attempt_register_user.yaml @@ -27,4 +27,5 @@ responses: properties: username: type: string - !include defs/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/create_rank.yaml b/apidoc/create_rank.yaml index d5eec3d0..3be370d0 100644 --- a/apidoc/create_rank.yaml +++ b/apidoc/create_rank.yaml @@ -34,4 +34,5 @@ responses: properties: rank: type: number - !include def/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/cross_post.yaml b/apidoc/cross_post.yaml index bbb25b08..36dc1102 100644 --- a/apidoc/cross_post.yaml +++ b/apidoc/cross_post.yaml @@ -36,4 +36,5 @@ responses: '$ref': '#/definitions/ArticleSummary' comment: '$ref': '#/definitions/Comment' - !include defs/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/delete_articles.yaml b/apidoc/delete_articles.yaml index aca3f175..88f225d8 100644 --- a/apidoc/delete_articles.yaml +++ b/apidoc/delete_articles.yaml @@ -25,4 +25,5 @@ responses: properties: success: type: boolean - !include defs/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/delete_comments.yaml b/apidoc/delete_comments.yaml index 13e29eee..bd1843d0 100644 --- a/apidoc/delete_comments.yaml +++ b/apidoc/delete_comments.yaml @@ -36,4 +36,5 @@ responses: properties: success: type: boolean - !include defs/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/delete_favorite.yaml b/apidoc/delete_favorite.yaml index ee3a3df0..9e2b041a 100644 --- a/apidoc/delete_favorite.yaml +++ b/apidoc/delete_favorite.yaml @@ -34,4 +34,5 @@ responses: success: type: boolean description: 是否成功刪除. - !include defs/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/edit_article.yaml b/apidoc/edit_article.yaml index cb182258..5ebe7ef5 100644 --- a/apidoc/edit_article.yaml +++ b/apidoc/edit_article.yaml @@ -46,4 +46,5 @@ responses: type: string class: type: string - !include defs/tokenuser.yaml + tokenuser: + '$ref': '#/definitions/tokenuser' diff --git a/apidoc/template.yaml b/apidoc/template.yaml index f8f1484d..7ecfa2e1 100644 --- a/apidoc/template.yaml +++ b/apidoc/template.yaml @@ -53,3 +53,4 @@ definitions: !include defs/man_article_summary.yaml !include defs/man_article_list.yaml !include defs/man_article_block.yaml + !include defs/tokenuser.yaml diff --git a/apidoc/yamltojson.py b/apidoc/yamltojson.py index ba264eae..64c1b01e 100755 --- a/apidoc/yamltojson.py +++ b/apidoc/yamltojson.py @@ -23,13 +23,13 @@ def include(self, node): result = {} for each in filename_list: with open(each, 'r') as f: - each_struct = yaml.load(f) + each_struct = yaml.full_load(f) result.update(each_struct) return result ''' with open(filename, 'r') as f: - return yaml.load(f, Loader) + return yaml.full_load(f, Loader) ''' @@ -37,7 +37,7 @@ def include(self, node): with open(src, 'r') as f: - the_struct = yaml.load(f) + the_struct = yaml.full_load(f) with open(dst, 'w') as f: json.dump(the_struct, f, indent=4)