openapi: actually catch the error when esprima fails at parsing the file

39f8a138d7 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 <benjamin.tissoires@gmail.com>
reviewable/pr3889/r1
Benjamin Tissoires 4 years ago
parent 63605ee42e
commit ebe39771a6
  1. 5
      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

Loading…
Cancel
Save