Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update token-user in apidoc #527

Merged
merged 1 commit into from
May 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apidoc/addsecurity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'] = {
Expand Down
6 changes: 4 additions & 2 deletions apidoc/apidoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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('/')
Expand Down Expand Up @@ -106,6 +106,7 @@ def _load_favorite_boards(user_id):
"""
return ''


@app.route(_with_app_prefix('/user/<user_id>/favorites/addboard'), methods=['POST'])
def _add_favorite_board(user_id):
"""
Expand Down Expand Up @@ -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 ''
return ''
3 changes: 2 additions & 1 deletion apidoc/attempt_register_user.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,5 @@ responses:
properties:
username:
type: string
!include defs/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
3 changes: 2 additions & 1 deletion apidoc/create_rank.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ responses:
properties:
rank:
type: number
!include def/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
3 changes: 2 additions & 1 deletion apidoc/cross_post.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ responses:
'$ref': '#/definitions/ArticleSummary'
comment:
'$ref': '#/definitions/Comment'
!include defs/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
3 changes: 2 additions & 1 deletion apidoc/delete_articles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ responses:
properties:
success:
type: boolean
!include defs/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
3 changes: 2 additions & 1 deletion apidoc/delete_comments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,5 @@ responses:
properties:
success:
type: boolean
!include defs/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
3 changes: 2 additions & 1 deletion apidoc/delete_favorite.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,5 @@ responses:
success:
type: boolean
description: 是否成功刪除.
!include defs/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
3 changes: 2 additions & 1 deletion apidoc/edit_article.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ responses:
type: string
class:
type: string
!include defs/tokenuser.yaml
tokenuser:
'$ref': '#/definitions/tokenuser'
1 change: 1 addition & 0 deletions apidoc/template.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
6 changes: 3 additions & 3 deletions apidoc/yamltojson.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ 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)
'''


yaml.add_constructor('!include', include)


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)
Loading