Semprini / pyMDG

UML Model Driven Generation of schema, code, data and documentation.
Other
21 stars 10 forks source link

Snakecase fails on null #7

Closed westpac-paul closed 3 years ago

westpac-paul commented 3 years ago

Traceback (most recent call last): File "c:\program files\python38\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\program files\python38\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Dev\python\venv\Scripts\mdg_generate.exe__main__.py", line 7, in File "c:\dev\python\venv\lib\site-packages\mdg\tools\mdg_generate.py", line 18, in main generate() File "c:\dev\python\venv\lib\site-packages\mdg\generate.py", line 26, in generate output_model(model_package) File "c:\dev\python\venv\lib\site-packages\mdg\render.py", line 159, in output_model output_model(child) File "c:\dev\python\venv\lib\site-packages\mdg\render.py", line 143, in output_model output_level_package(source_template, dest_file_template, package) File "c:\dev\python\venv\lib\site-packages\mdg\render.py", line 45, in output_level_package fh.write(source_template.render(package=package)) File "c:\dev\python\venv\lib\site-packages\jinja2\environment.py", line 1090, in render self.environment.handle_exception() File "c:\dev\python\venv\lib\site-packages\jinja2\environment.py", line 832, in handle_exception reraise(*rewrite_traceback_stack(source=source)) File "c:\dev\python\venv\lib\site-packages\jinja2_compat.py", line 28, in reraise raise value.with_traceback(tb) File "./sample_recipie/templates\openapi.yaml.jinja", line 28, in top-level template code operationId: {{ cls.path | snakecase }}list File "c:\dev\python\venv\lib\site-packages\mdg\tools\case.py", line 150, in snakecase val = re.sub(r"[A-Z]", lambda matched: '' + lowercase(matched.group(0)), string) File "c:\program files\python38\lib\re.py", line 210, in sub return _compile(pattern, flags).sub(repl, string, count) TypeError: expected string or bytes-like object