api-generator-templates/KotlinServer/blocks/class/constructor-fields-info.twig

16 lines
897 B
Twig

{%- import '../../utils.twig' as utils -%}
{%- for field in fields %}
{%- if field.type.type.baseTypeName == "DateTime" %}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "{{ utils.getDateFormat(field) }}", timezone = "utc")
{%- endif %}
{%- if field.type.type.baseTypeName == "Date" %}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "{{ utils.getDateFormat(field) }}")
{%- endif %}
{%- if field.optional %}
@JsonInclude(JsonInclude.Include.NON_NULL)
{%- elseif field.nullable %}
@JsonInclude(JsonInclude.Include.ALWAYS)
{%- endif %}
{% if not (field in superclassesFields) %}val {% endif %}{{ field.name }}: {{ utils.formatValueType(field.type.type, field.nullable, field.optional) }}{{ utils.writeNullCheckMark(field.nullable, field.optional) }} {%- if not (loop.last) %},{% endif %}{{ utils.addDescription(field) }}
{%- endfor -%}