Skip to content

Commit

Permalink
Merge pull request #3 from KingPack/doc
Browse files Browse the repository at this point in the history
Update Documentation Swagger
  • Loading branch information
KingPack authored Feb 10, 2022
2 parents e9116ef + 1659edd commit 2fed746
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tags:
- "Article"
summary: "Deleta artigo."
description: "Essa rota deleta o artigo por {ID}."
produces:
- "application/json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tags:
- "Article"
summary: "Lista artigo."
description: "Lista um artigo por {id}. "
produces:
- "application/json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tags:
- "Article"
summary: "Atualiza artigo."
description: "Atualiza um artigo por {ID}."
produces:
- "application/json"
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
tags:
- "Article"
summary: "Adiciona artigo."
description: "Adiciona artigo por {ID}."
produces:
- "application/json"
23 changes: 22 additions & 1 deletion Space_Flight/space_flight/blueprint/space_flight_v1/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def articles_get():


@bp.route('/articles', methods=['POST'])
@doc_swagger.swag_from("docs/articles_POST.yaml")
def articles_post():
request_json = request.get_json()

Expand All @@ -41,6 +42,26 @@ def articles_post():
return jsonify(data_return)


@bp.route('/articles/<int:id_article>', methods=['DELETE'])
@doc_swagger.swag_from("docs/article_DELETE.yaml")
def article_delete():
request_json = request.get_json()

data_return = request_json

return jsonify(data_return)




@bp.route('/articles/<int:id_article>', methods=['GET'])
def article(id_article):
@doc_swagger.swag_from("docs/article_id_GET.yaml")
def article_get(id_article):
return Response(f'artigo {id_article}', status=200, mimetype='text/html')



@bp.route('/articles/<int:id_article>', methods=['PUT'])
@doc_swagger.swag_from("docs/article_id_PUT.yaml")
def article_put(id_article):
return Response(f'artigo {id_article}', status=200, mimetype='text/html')
2 changes: 1 addition & 1 deletion Space_Flight/space_flight/ext/doc_swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"info": {
"title": "Spaceflight News API",
"description": "Documentation for the Spaceflight News API. Join The Space Devs Discord server to contact me for support :) NOTE: to use filters like _contains, specify the field you want to filter. For example: title_contains=nasa. This can not be done in this Swagger interface. More info and examples.",
"version": "0.1",
"version": "0.2.1",
}
}

Expand Down

0 comments on commit 2fed746

Please sign in to comment.