Merge pull request #85 from TouchInstinct/fix/optional_fields_check

kotlin-server: optional fields check first
This commit is contained in:
Alexander Buntakov 2019-07-23 17:14:39 +03:00 committed by GitHub
commit 2cdfec1a6b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -7,10 +7,10 @@
{%- if field.type.type.baseTypeName == "Date" %}
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "{{ utils.getDateFormat(field) }}")
{%- endif %}
{%- if field.nullable %}
@JsonInclude(JsonInclude.Include.ALWAYS)
{%- elseif field.optional %}
{%- 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 -%}