From 580ecda701a90ad26d246a811b2b617bab0882ec Mon Sep 17 00:00:00 2001 From: Elena Bobkova Date: Tue, 23 Jul 2019 17:13:08 +0300 Subject: [PATCH] optional fields check first --- KotlinServer/blocks/class/constructor-fields-info.twig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/KotlinServer/blocks/class/constructor-fields-info.twig b/KotlinServer/blocks/class/constructor-fields-info.twig index 9ba9803..c1dd2d5 100644 --- a/KotlinServer/blocks/class/constructor-fields-info.twig +++ b/KotlinServer/blocks/class/constructor-fields-info.twig @@ -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 -%} \ No newline at end of file