Skip to content

Commit d58553d

Browse files
authored
fix: when there are no schema properties, we add 'pass' to the constructor (#85)
* fix: when there are no schema properties, we add 'pass' to the schema's constructor. * Made formatting of template vars more consistent.
1 parent d0a3b60 commit d58553d

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

partials/model-class

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
{% set indent3 = indentLevel | indent3 -%}
66
{% set indent4 = indentLevel | indent4 -%}
77

8-
{{ indent1 }}class {{name | upperFirst}}(Entity):
8+
{{ indent1 }}class {{ name | upperFirst }}(Entity):
99
{% for name, prop in properties -%}
1010
{%- set typeInfo = [name, prop] | getTypeInfo -%}
1111
{%- if typeInfo.recursive -%}
@@ -17,18 +17,19 @@
1717
{% endfor -%}
1818
{%- endif %}
1919
{%- endfor %}
20-
{{indent2}}def __init__(
20+
{{ indent2 }}def __init__(
2121
{{ indent4 }}self
2222
{%- for name, prop in properties -%}
2323
{%- set typeInfo = [name, prop] | getTypeInfo -%}
2424
,
25-
{{ indent4 }}{{typeInfo.pythonName}}{{ ": " + typeInfo.pythonType if typeInfo.pythonType else ""}}
25+
{{ indent4 }}{{ typeInfo.pythonName }}{{ ": " + typeInfo.pythonType if typeInfo.pythonType else "" }}
2626
{%- endfor -%}
2727
):
2828
{%- for name, prop in properties -%}
2929
{%- set typeInfo = [name, prop] | getTypeInfo %}
30-
{{ indent3}}self.{{typeInfo.pythonName}} = {{typeInfo.pythonName}}
30+
{{ indent3 }}self.{{ typeInfo.pythonName }} = {{ typeInfo.pythonName }}
31+
{%- else %}
32+
{{ indent3 }}pass
3133
{%- endfor %}
3234

33-
3435
{% endmacro -%}

0 commit comments

Comments
 (0)