{% if schemas %}
"""Generated Marshmallow schemas for {{ spec.name }} {{ version }}."""

import marshmallow as ma
{% if custom_field_names %}

from {{ package_name }}.fields import (
{% for name in custom_field_names %}
    {{ name }},
{% endfor %}
)
{% endif %}
{% for schema in schemas %}


class {{ schema.name }}(ma.Schema):
{% if not schema.fields %}
    pass
{% else %}
{% for field in schema.fields %}
{% if field.field_type == 'Nested' %}
    {{ field.name }} = ma.fields.Dict({{ field | field_kwargs }})
{% elif field.field_type == 'Enum' %}
    {{ field.name }} = ma.fields.String({{ field | field_kwargs }})
{% elif field.field_type in custom_field_names %}
    {{ field.name }} = {{ field.field_type }}({{ field | field_kwargs }})
{% else %}
    {{ field.name }} = ma.fields.{{ field.field_type }}({{ field | field_kwargs }})
{% endif %}
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
