From 1eea102f26be23c65aa6abf44373fe963acd8946 Mon Sep 17 00:00:00 2001 From: Benjamin Tissoires Date: Tue, 14 May 2019 10:10:21 +0200 Subject: openAPI: also handle `export` statement in the scripts The files are actually modules, not plain scripts, and thus we are allowed to use `export`. Without `parseModule`, the script would silently fail when parsing `export.js` and the export function will not be present. --- openapi/generate_openapi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'openapi') diff --git a/openapi/generate_openapi.py b/openapi/generate_openapi.py index 2a898f0e..1bf04c15 100644 --- a/openapi/generate_openapi.py +++ b/openapi/generate_openapi.py @@ -678,7 +678,7 @@ def parse_schemas(schemas_dir): data = ''.join(f.readlines()) try: # if the file failed, it's likely it doesn't contain a schema - program = esprima.parseScript(data, options={'comment': True, 'loc': True}) + program = esprima.parseModule(data, options={'comment': True, 'loc': True}) except: continue -- cgit v1.2.3-1-g7c22