소스 검색

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.
Benjamin Tissoires 6 년 전
부모
커밋
1eea102f26
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      openapi/generate_openapi.py

+ 1 - 1
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