File: Union.jinja2

package info (click to toggle)
python-datamodel-code-generator 0.26.4-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 712 kB
  • sloc: python: 9,525; makefile: 14
file content (10 lines) | stat: -rw-r--r-- 258 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
{%- if description %}
# {{ description }}
{%- endif %}
{%- if fields|length > 1 %}
{{ class_name }}: TypeAlias = Union[
{%- for field in fields %}
    '{{ field.name }}',
{%- endfor %}
]{% else %}
{{ class_name }}: TypeAlias = {{ fields[0].name }}{% endif %}