Commit 2f8622ce authored by Goran Pavlovic's avatar Goran Pavlovic
Browse files

Merge branch 'pierrecdn-master'

parents c48091e7 7f39b95b
......@@ -27,7 +27,7 @@ def _extract_swagger_docs(end_point_doc, method="get"):
# Build JSON YAML Obj
try:
end_point_swagger_doc = (
yaml.load("\n".join(end_point_doc[end_point_swagger_start:]), Loader=yaml.FullLoader)
yaml.full_load("\n".join(end_point_doc[end_point_swagger_start:]))
)
except yaml.YAMLError:
end_point_swagger_doc = {
......@@ -37,6 +37,7 @@ def _extract_swagger_docs(end_point_doc, method="get"):
}
return {method: end_point_swagger_doc}
def _build_doc_from_func_doc(route):
out = {}
......@@ -60,6 +61,7 @@ def _build_doc_from_func_doc(route):
out.update(_extract_swagger_docs(end_point_doc, method=str(route.method).lower()))
return out
def generate_doc_from_each_end_point(
app: web.Application,
*,
......@@ -106,7 +108,7 @@ def generate_doc_from_each_end_point(
)
# The Swagger OBJ
swagger = yaml.load(swagger_base, Loader=yaml.FullLoader)
swagger = yaml.full_load(swagger_base)
swagger["paths"] = defaultdict(dict)
for route in app.router.routes():
......@@ -119,7 +121,7 @@ def generate_doc_from_each_end_point(
with open(route.handler.swagger_file, "r") as f:
end_point_doc = {
route.method.lower():
yaml.load(f.read(), Loader=yaml.FullLoader)
yaml.full_load(f.read())
}
except yaml.YAMLError:
end_point_doc = {
......@@ -157,7 +159,7 @@ def generate_doc_from_each_end_point(
def load_doc_from_yaml_file(doc_path: str):
loaded_yaml = yaml.load(open(doc_path, "r", encoding="utf-8").read(), Loader=yaml.FullLoader)
loaded_yaml = yaml.full_load(open(doc_path, "r").read())
return json.dumps(loaded_yaml)
......
......@@ -208,7 +208,7 @@ def test_swagger_def_decorator(test_client, loop):
@pytest.fixture
def swagger_info():
filename = abspath(join(dirname(__file__))) + "/data/example_swagger.yaml"
return yaml.load(open(filename).read())
return yaml.full_load(open(filename).read())
@asyncio.coroutine
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment