shinesolutions/swagger-aem-osgi

[python] openapi-generator 5.0 produces unit test and doc generation errors

Closed this issue · 1 comments

I'll have to disable Python client Makefile test-unit and doc targets for the time being due to an error from the generated code from openapi-generator 5.0

/github/workspace/clients/doc/python/master/stage/swaggeraemosgi.model.rst:746: WARNING: autodoc: failed to import module u'swaggeraemosgi.model.com_adobe_cq_deserfw_impl_deserialization_firewall_impl_info'; the following exception was raised:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/sphinx/ext/autodoc.py", line 519, in import_object
    __import__(self.modname)
  File "build/bdist.linux-x86_64/egg/swaggeraemosgi/__init__.py", line 17, in <module>
  File "/usr/lib/python2.7/site-packages/swaggeraemosgi-1.0.0-py2.7.egg/swaggeraemosgi/api_client.py", line 120
    resource_path: str,
                 ^
SyntaxError: invalid syntax

openapi-generator 5.0 is the first version used when the effort for resurrecting Python client started.

It turned out that the build failure was caused by old python2-only compatible dependencies which causes the build to run using Python2. Meanwhile, the invalid syntax (e.g. resource_path: str) is type hinting feature which was introduced in Python 3.5.

To solve the problem, I've updated the build to run on Python 3.6, with dependencies upgraded to python3-compatible versions, and also by using pip3 and python3 binaries.