anon-iclr-submission/benchname-bug-localization huggingface dataset:
Repository: wekan/wekan
Issue: Building OpenAPI docs is broken in Wekan v3.56

Hi,
building OpenAPI docs is broken in upcoming Wekan v3.56. Maybe it's related to added tests?
https://github.com/wekan/wekan/blob/master/CHANGELOG.md
```
$ ./releases/rebuild-docs.sh 5.36
Traceback (most recent call last):
  File "./openapi/generate_openapi.py", line 1073, in <module>
    main()
  File "./openapi/generate_openapi.py", line 1068, in main
    schemas, entry_points = parse_schemas(args.dir)
  File "./openapi/generate_openapi.py", line 824, in parse_schemas
    program = context.program
AttributeError: 'NoneType' object has no attribute 'program'
✓ Read source file!
✗ Error during conversion via Widdershin:
Cannot read property 'swagger' of undefined
```

@bentiss can you look at this?

Changed files:
openapi/generate_openapi.py

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
Repository: wekan/wekan
Issue: Generating WeKan OpenAPI docs does not work

@bentiss

Hi ! Do you have time to fix generating WeKan OpenAPI docs? I'm using Ubuntu 23.04 amd64 with XFCE desktop.

I tried to fix it at https://github.com/wekan/wekan/commit/97c6b6531502d09cbd6c267212651f3036338a11

But I still get this error message:

```
✓ Read source file!
Failed to parse the source OpenAPI document
```

Changed files:
openapi/generate_openapi.py

diff --git a/openapi/generate_openapi.py b/openapi/generate_openapi.py
index 4b6aa9a27..684aebc63 100644
--- a/openapi/generate_openapi.py
+++ b/openapi/generate_openapi.py
@@ -67,11 +67,9 @@ def get_req_body_elems(obj, elems):
         get_req_body_elems(obj.right, elems)
     elif obj.type in ('ReturnStatement', 'UnaryExpression'):
         get_req_body_elems(obj.argument, elems)
-    elif obj.type == 'Literal':
-        pass
     elif obj.type == 'Identifier':
         return obj.name
-    elif obj.type == 'FunctionDeclaration':
+    elif obj.type in ['Literal', 'FunctionDeclaration', 'ThrowStatement']:
         pass
     else:
         print(obj)