From ebe39771a64069ff768123d6015ce2f184a8c8ed Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Thu, 1 Jul 2021 10:19:13 +0200 Subject: [PATCH] openapi: actually catch the error when esprima fails at parsing the file 39f8a138d7ba added a try/except around esprima to catch any hard error from the parsing, but the returned value was not checked. We now have the file models/exportExcel.js which gives us an unexpected symbol on line 3 (not sure why it is not happy), but that fails the generation of the doc entirely. Fixes #3884 Signed-off-by: Benjamin Tissoires --- openapi/generate_openapi.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/openapi/generate_openapi.py b/openapi/generate_openapi.py index 9aed62e4f..4b6aa9a27 100644 --- a/openapi/generate_openapi.py +++ b/openapi/generate_openapi.py @@ -821,6 +821,11 @@ def parse_schemas(schemas_dir): for filename in files: path = os.path.join(root, filename) context = parse_file(path) + + if context is None: + # the file doesn't contain a schema (see above) + continue + program = context.program current_schema = None