From 158605b112430559f0b0d427d2f16a6179af07e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=20Enrique=20Garc=C3=ADa=20Maci=C3=B1eiras?= Date: Fri, 2 Jun 2023 14:23:56 +0200 Subject: [PATCH] #160 Fix Templates and white spaces --- .../plugin/openapi/model/TypeConstants.java | 6 + .../openapi/utils/MapperContentUtil.java | 132 +++++++++--------- .../openapi/OpenApiGeneratorFixtures.java | 12 +- .../assets/ApiDefaultItemDTO.java | 91 ++++++------ .../InlineResponse200CreateGameDTO.java | 12 +- .../assets/MessageDTO.java | 12 +- 6 files changed, 142 insertions(+), 123 deletions(-) diff --git a/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/model/TypeConstants.java b/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/model/TypeConstants.java index b25ecd71..29efed45 100644 --- a/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/model/TypeConstants.java +++ b/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/model/TypeConstants.java @@ -10,6 +10,8 @@ public final class TypeConstants { + private static final Set BOOLEAN_VALUES = Set.of(Boolean.TRUE.toString(), Boolean.FALSE.toString()); + public static final String NUMBER = "number"; public static final String BOOLEAN = "boolean"; @@ -74,6 +76,10 @@ public final class TypeConstants { OFFSETDATETIME ); + public static boolean isBoolean(final String isBoolean) { + return BOOLEAN_VALUES.contains(isBoolean.toLowerCase()); + } + public enum TimeType { LOCAL, ZONED, diff --git a/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/utils/MapperContentUtil.java b/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/utils/MapperContentUtil.java index 031dac39..c6f19913 100644 --- a/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/utils/MapperContentUtil.java +++ b/multiapi-engine/src/main/java/com/sngular/api/generator/plugin/openapi/utils/MapperContentUtil.java @@ -6,6 +6,14 @@ package com.sngular.api.generator.plugin.openapi.utils; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Objects; +import java.util.function.Consumer; + import com.fasterxml.jackson.databind.JsonNode; import com.sngular.api.generator.plugin.common.tools.ApiTool; import com.sngular.api.generator.plugin.openapi.exception.BadDefinedEnumException; @@ -18,11 +26,6 @@ import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; -import java.util.*; -import java.util.Map.Entry; -import java.util.function.Consumer; - - public class MapperContentUtil { private static final String ADDITIONAL_PROPERTY_NAME = "AdditionalProperty"; @@ -44,9 +47,9 @@ public static Map mapComponentToSchemaObject( } private static Map mapComponentToSchemaObject( - final Map totalSchemas, final Map compositedSchemas, - final List antiLoopList, final JsonNode schema, final String nameSchema, final SpecFile specFile, - final String modelPackage) { + final Map totalSchemas, final Map compositedSchemas, + final List antiLoopList, final JsonNode schema, final String nameSchema, final SpecFile specFile, + final String modelPackage) { antiLoopList.add(nameSchema); final var listSchema = getFields(totalSchemas, schema, specFile, compositedSchemas, antiLoopList); @@ -146,7 +149,7 @@ private static List getFields( .getProperties(schema) .forEachRemaining(processProperties(totalSchemas, compositedSchemas, fieldObjectArrayList, specFile, schema, antiLoopList)); fieldObjectArrayList.addAll( - processFieldObjectList("additionalProperties", null, schema, specFile, totalSchemas, compositedSchemas, antiLoopList)); + processAdditionalProperties("additionalProperties", schema, specFile, totalSchemas, compositedSchemas, antiLoopList)); } else { ApiTool.getProperties(schema).forEachRemaining(processProperties(totalSchemas, compositedSchemas, fieldObjectArrayList, specFile, schema, antiLoopList)); } @@ -206,13 +209,15 @@ private static List processAnyOfOneOf( final String[] pathObjectRef = ApiTool.getRefValue(internalSchema).split("/"); final String schemaName = pathObjectRef[pathObjectRef.length - 1]; final var schemaToProcess = totalSchemas.get(schemaName); - if (compositedSchemas.containsKey(schemaName)) { + if (compositedSchemas.containsKey(schemaName) || antiLoopList.contains(schemaName)) { fieldObjectArrayList.add(SchemaFieldObject .builder() .baseName(schemaName) - .dataType(new SchemaFieldObjectType(schemaName)) + .dataType(SchemaFieldObjectType.fromTypeList(MapperUtil.getSimpleType(totalSchemas.get(schemaName), specFile), + MapperUtil.getPojoName(schemaName, specFile))) .build()); } else { + antiLoopList.add(schemaName); ApiTool.getProperties(schemaToProcess) .forEachRemaining(processProperties(totalSchemas, compositedSchemas, fieldObjectArrayList, specFile, schemaToProcess, antiLoopList)); } @@ -230,28 +235,20 @@ private static List processAnyOfOneOf( private static List processFieldObjectList( final String fieldName, final String className, final JsonNode schema, final SpecFile specFile, final Map totalSchemas, final Map compositedSchemas, final List antiLoopList) { - final var fieldObjectArrayList = new LinkedList(); + final var fieldObjectArrayList = new ArrayList(); if (TypeConstants.ARRAY.equalsIgnoreCase(ApiTool.getType(schema))) { fieldObjectArrayList.addAll(processArray(fieldName, className, schema, specFile, totalSchemas, compositedSchemas, antiLoopList)); } else if (ApiTool.hasAdditionalProperties(schema)) { fieldObjectArrayList.addAll(processMap(fieldName, schema, specFile, totalSchemas, compositedSchemas, antiLoopList)); } else if (ApiTool.hasRef(schema)) { - final String refSchemaName = getRef(schema, specFile); - final var field = SchemaFieldObject.builder() - .baseName(fieldName) - .dataType(new SchemaFieldObjectType(MapperUtil.getSimpleType(schema, specFile))) - .build(); - setFieldType(field, schema, schema, specFile, refSchemaName); - fieldObjectArrayList.add(field); - } else if (!ApiTool.isObject(schema) || !ApiTool.isComposed(schema)) { - final var field = SchemaFieldObject - .builder() - .baseName(fieldName) - .dataType(new SchemaFieldObjectType(MapperUtil.getSimpleType(schema, specFile))) - .build(); - setFieldType(field, schema, schema, specFile, ""); - fieldObjectArrayList.add(field); + fieldObjectArrayList.add(processRef(fieldName, schema, specFile)); + } else if (ApiTool.isObject(schema) && !ApiTool.hasProperties(schema)) { + fieldObjectArrayList.add(SchemaFieldObject + .builder() + .baseName(fieldName) + .dataType(new SchemaFieldObjectType(TypeConstants.OBJECT)) + .build()); } else if (!ApiTool.hasProperties(schema) && !ApiTool.isComposed(schema)) { fieldObjectArrayList.add(SchemaFieldObject .builder() @@ -279,7 +276,17 @@ private static List processFieldObjectList( return fieldObjectArrayList; } - private static Consumer> processProperties( + private static SchemaFieldObject processRef(String fieldName, JsonNode schema, SpecFile specFile) { + final String refSchemaName = getRef(schema, specFile); + final var field = SchemaFieldObject.builder() + .baseName(fieldName) + .dataType(new SchemaFieldObjectType(MapperUtil.getSimpleType(schema, specFile))) + .build(); + setFieldType(field, schema, schema, specFile, refSchemaName); + return field; + } + + private static Consumer> processProperties( final Map totalSchemas, final Map compositedSchemas, final List fieldObjectArrayList, final SpecFile specFile, final JsonNode schema, final List antiLoopList) { return field -> { @@ -499,61 +506,61 @@ private static List processMap( } if (ApiTool.hasProperties(schema)) { - fieldObjectArrayList.addAll(processAdditionalProperties(fieldName, schema, specFile)); + fieldObjectArrayList.addAll(processAdditionalProperties(fieldName, schema, specFile, totalSchemas, compositedSchemas, antiLoopList)); } return fieldObjectArrayList; } - private static List processAdditionalProperties(final String fieldName, final JsonNode schema, final SpecFile specFile) { + private static List processAdditionalProperties(final String fieldName, final JsonNode schema, final SpecFile specFile, Map totalSchemas, Map compositedSchemas, List antiLoopList) { final var fieldObjectArrayList = new ArrayList(); final var addPropObj = ApiTool.getAdditionalProperties(schema); - if (TypeConstants.BOOLEAN.equalsIgnoreCase(ApiTool.getType(addPropObj))) { + if (TypeConstants.isBoolean(addPropObj.asText())) { fieldObjectArrayList .add(SchemaFieldObject .builder() .baseName(fieldName) .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, TypeConstants.OBJECT)) .build()); + } else if (ApiTool.hasRef(addPropObj)) { + final String refSchemaName = getRef(addPropObj, specFile); + final var field = SchemaFieldObject.builder() + .baseName(fieldName) + .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, refSchemaName)) + .build(); + setFieldType(field, schema, addPropObj, specFile, refSchemaName); + fieldObjectArrayList.add(field); + } else if (ApiTool.hasItems(addPropObj)) { + fieldObjectArrayList + .add(SchemaFieldObject + .builder() + .baseName(fieldName) + .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, TypeConstants.ARRAY, + MapperUtil.getSimpleType(ApiTool.getItems(addPropObj), specFile))) + .build()); } else { - final var additionalProperties = ApiTool.getAdditionalProperties(schema); - if (ApiTool.hasRef(additionalProperties)) { - final String refSchemaName = getRef(additionalProperties, specFile); - final var field = SchemaFieldObject.builder() - .baseName(fieldName) - .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, refSchemaName)) - .build(); - setFieldType(field, schema, additionalProperties, specFile, refSchemaName); - fieldObjectArrayList.add(field); - } else if (ApiTool.hasItems(additionalProperties)) { - fieldObjectArrayList - .add(SchemaFieldObject - .builder() - .baseName("additionalProperties") - .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, TypeConstants.ARRAY, MapperUtil.getSimpleType(ApiTool.getItems(additionalProperties), specFile))) - .build()); - } else { - final String type = isBasicType(additionalProperties) ? MapperUtil.getSimpleType(additionalProperties, specFile) - : MapperUtil.getPojoName(ApiTool.getName(schema) + ADDITIONAL_PROPERTY_NAME, specFile); - fieldObjectArrayList - .add(SchemaFieldObject - .builder() - .baseName(fieldName) - .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, type)) - .build()); - } + final String type = isBasicType(addPropObj) ? MapperUtil.getSimpleType(addPropObj, specFile) + : MapperUtil.getPojoName(ApiTool.getName(schema) + ADDITIONAL_PROPERTY_NAME, specFile); + fieldObjectArrayList + .add(SchemaFieldObject + .builder() + .baseName(fieldName) + .dataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, type)) + .build()); } return fieldObjectArrayList; } private static boolean isBasicType(final JsonNode value) { - return !(ApiTool.isObject(value) || ApiTool.isArray(value) || ApiTool.isComposed(value) || ApiTool.hasAdditionalProperties(value)); + return !(ApiTool.isObject(value) || ApiTool.isArray(value) || ApiTool.isComposed(value) + || ApiTool.hasAdditionalProperties(value)); } private static SchemaObject createComposedSchema( - final String fieldName, final JsonNode schema, final SpecFile specFile, final Map totalSchemas, final Map compositedSchemas, + final String fieldName, final JsonNode schema, final SpecFile specFile, final Map totalSchemas, + final Map compositedSchemas, final List antiLoopList) { final var fieldObjectArrayList = new ArrayList(); String schemaCombinatorType = ""; @@ -580,7 +587,8 @@ private static SchemaObject createComposedSchema( .build(); } - private static void setFieldType(final SchemaFieldObject field, final JsonNode value, final JsonNode schema, final SpecFile specFile, final String key) { + private static void setFieldType(final SchemaFieldObject field, final JsonNode value, final JsonNode schema, + final SpecFile specFile, final String key) { field.setRequired(ApiTool.hasRequired(schema) && ApiTool.checkIfRequired(schema, key)); if (ApiTool.isArray(value)) { final String typeArray; @@ -596,10 +604,6 @@ private static void setFieldType(final SchemaFieldObject field, final JsonNode v field.setDataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, typeObject)); field.setImportClass(getImportClass(typeObject)); -/* final var typeMap = MapperUtil.getTypeMap((MapSchema) value, specFile); - field.setDataType(SchemaFieldObjectType.fromTypeList(TypeConstants.MAP, typeMap)); - field.setImportClass(getImportClass(typeMap));*/ - } else if (ApiTool.isObject(value)) { var typeObject = ApiTool.getType(value); if (ApiTool.hasRef(value)) { diff --git a/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorFixtures.java b/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorFixtures.java index 9b5e7532..c8ed68a3 100644 --- a/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorFixtures.java +++ b/multiapi-engine/src/test/java/com/sngular/api/generator/plugin/openapi/OpenApiGeneratorFixtures.java @@ -6,10 +6,7 @@ package com.sngular.api.generator.plugin.openapi; -import com.sngular.api.generator.plugin.openapi.model.TypeConstants.TimeType; -import com.sngular.api.generator.plugin.openapi.parameter.SpecFile; -import com.sngular.api.generator.test.utils.TestUtils; -import org.apache.commons.collections4.CollectionUtils; +import static org.assertj.core.api.Assertions.assertThat; import java.io.File; import java.io.IOException; @@ -18,7 +15,10 @@ import java.util.List; import java.util.function.Function; -import static org.assertj.core.api.Assertions.assertThat; +import com.sngular.api.generator.plugin.openapi.model.TypeConstants.TimeType; +import com.sngular.api.generator.plugin.openapi.parameter.SpecFile; +import com.sngular.api.generator.test.utils.TestUtils; +import org.apache.commons.collections4.CollectionUtils; public final class OpenApiGeneratorFixtures { @@ -518,7 +518,7 @@ static Function validateComplexAnyOf() { ASSETS_PATH + "ApiArrayFieldDTO.java", ASSETS_PATH + "ApiBooleanFieldDTO.java", ASSETS_PATH + "ApiDateFieldDTO.java", - // ASSETS_PATH + "ApiDefaultItemDTO.java", + ASSETS_PATH + "ApiDefaultItemDTO.java", ASSETS_PATH + "ApiEnumFieldDTO.java", ASSETS_PATH + "ApiMapFieldDTO.java", ASSETS_PATH + "ApiNumberFieldDTO.java", diff --git a/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/ApiDefaultItemDTO.java b/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/ApiDefaultItemDTO.java index 1b3dfc06..c640a402 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/ApiDefaultItemDTO.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testComplexAnyOf/assets/ApiDefaultItemDTO.java @@ -12,27 +12,36 @@ public class ApiDefaultItemDTO { @JsonProperty(value ="stringField") - private StringField stringField; + private ApiStringFieldDTO stringField; + @JsonProperty(value ="sequenceField") private ApiSequenceFieldDTO sequenceField; + @JsonProperty(value ="dateField") - private DateField dateField; + private ApiDateFieldDTO dateField; + @JsonProperty(value ="enumField") - private EnumField enumField; + private ApiEnumFieldDTO enumField; + @JsonProperty(value ="booleanField") - private BooleanField booleanField; + private ApiBooleanFieldDTO booleanField; + @JsonProperty(value ="arrayField") - private ArrayField arrayField; + private ApiArrayFieldDTO arrayField; + @JsonProperty(value ="numberField") - private NumberField numberField; + private ApiNumberFieldDTO numberField; + @JsonProperty(value ="objectField") - private ObjectField objectField; + private ApiObjectFieldDTO objectField; + @JsonProperty(value ="mapField") - private MapField mapField; + private ApiMapFieldDTO mapField; + @JsonProperty(value ="unionField") private ApiUnionFieldDTO unionField; - private ApiDefaultItemDTO(StringField stringField, ApiSequenceFieldDTO sequenceField, DateField dateField, EnumField enumField, BooleanField booleanField, ArrayField arrayField, NumberField numberField, ObjectField objectField, MapField mapField, ApiUnionFieldDTO unionField) { + private ApiDefaultItemDTO(ApiStringFieldDTO stringField, ApiSequenceFieldDTO sequenceField, ApiDateFieldDTO dateField, ApiEnumFieldDTO enumField, ApiBooleanFieldDTO booleanField, ApiArrayFieldDTO arrayField, ApiNumberFieldDTO numberField, ApiObjectFieldDTO objectField, ApiMapFieldDTO mapField, ApiUnionFieldDTO unionField) { this.stringField = stringField; this.sequenceField = sequenceField; this.dateField = dateField; @@ -69,18 +78,18 @@ public static ApiDefaultItemDTO.ApiDefaultItemDTOBuilder builder() { @JsonPOJOBuilder(buildMethodName = "build", withPrefix = "") public static class ApiDefaultItemDTOBuilder { - private StringField stringField; + private ApiStringFieldDTO stringField; private ApiSequenceFieldDTO sequenceField; - private DateField dateField; - private EnumField enumField; - private BooleanField booleanField; - private ArrayField arrayField; - private NumberField numberField; - private ObjectField objectField; - private MapField mapField; + private ApiDateFieldDTO dateField; + private ApiEnumFieldDTO enumField; + private ApiBooleanFieldDTO booleanField; + private ApiArrayFieldDTO arrayField; + private ApiNumberFieldDTO numberField; + private ApiObjectFieldDTO objectField; + private ApiMapFieldDTO mapField; private ApiUnionFieldDTO unionField; - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder stringField(StringField stringField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder stringField(ApiStringFieldDTO stringField) { this.stringField = stringField; return this; } @@ -89,37 +98,37 @@ public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder sequenceField(ApiSequenceField return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder dateField(DateField dateField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder dateField(ApiDateFieldDTO dateField) { this.dateField = dateField; return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder enumField(EnumField enumField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder enumField(ApiEnumFieldDTO enumField) { this.enumField = enumField; return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder booleanField(BooleanField booleanField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder booleanField(ApiBooleanFieldDTO booleanField) { this.booleanField = booleanField; return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder arrayField(ArrayField arrayField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder arrayField(ApiArrayFieldDTO arrayField) { this.arrayField = arrayField; return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder numberField(NumberField numberField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder numberField(ApiNumberFieldDTO numberField) { this.numberField = numberField; return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder objectField(ObjectField objectField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder objectField(ApiObjectFieldDTO objectField) { this.objectField = objectField; return this; } - public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder mapField(MapField mapField) { + public ApiDefaultItemDTO.ApiDefaultItemDTOBuilder mapField(ApiMapFieldDTO mapField) { this.mapField = mapField; return this; } @@ -136,10 +145,10 @@ public ApiDefaultItemDTO build() { @Schema(name = "stringField", required = false) - public StringField getStringField() { + public ApiStringFieldDTO getApiStringFieldDTO() { return stringField; } - public void setStringField(StringField stringField) { + public void setApiStringFieldDTO(ApiStringFieldDTO stringField) { this.stringField = stringField; } @@ -154,64 +163,64 @@ public void setSequenceField(ApiSequenceFieldDTO sequenceField) { @Schema(name = "dateField", required = false) - public DateField getDateField() { + public ApiDateFieldDTO getApiDateFieldDTO() { return dateField; } - public void setDateField(DateField dateField) { + public void setApiDateFieldDTO(ApiDateFieldDTO dateField) { this.dateField = dateField; } @Schema(name = "enumField", required = false) - public EnumField getEnumField() { + public ApiEnumFieldDTO getApiEnumFieldDTO() { return enumField; } - public void setEnumField(EnumField enumField) { + public void setApiEnumFieldDTO(ApiEnumFieldDTO enumField) { this.enumField = enumField; } @Schema(name = "booleanField", required = false) - public BooleanField getBooleanField() { + public ApiBooleanFieldDTO getApiBooleanFieldDTO() { return booleanField; } - public void setBooleanField(BooleanField booleanField) { + public void setApiBooleanFieldDTO(ApiBooleanFieldDTO booleanField) { this.booleanField = booleanField; } @Schema(name = "arrayField", required = false) - public ArrayField getArrayField() { + public ApiArrayFieldDTO getApiArrayFieldDTO() { return arrayField; } - public void setArrayField(ArrayField arrayField) { + public void setApiArrayFieldDTO(ApiArrayFieldDTO arrayField) { this.arrayField = arrayField; } @Schema(name = "numberField", required = false) - public NumberField getNumberField() { + public ApiNumberFieldDTO getApiNumberFieldDTO() { return numberField; } - public void setNumberField(NumberField numberField) { + public void setApiNumberFieldDTO(ApiNumberFieldDTO numberField) { this.numberField = numberField; } @Schema(name = "objectField", required = false) - public ObjectField getObjectField() { + public ApiObjectFieldDTO getApiObjectFieldDTO() { return objectField; } - public void setObjectField(ObjectField objectField) { + public void setApiObjectFieldDTO(ApiObjectFieldDTO objectField) { this.objectField = objectField; } @Schema(name = "mapField", required = false) - public MapField getMapField() { + public ApiMapFieldDTO getApiMapFieldDTO() { return mapField; } - public void setMapField(MapField mapField) { + public void setApiMapFieldDTO(ApiMapFieldDTO mapField) { this.mapField = mapField; } diff --git a/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/InlineResponse200CreateGameDTO.java b/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/InlineResponse200CreateGameDTO.java index 42d5b287..3da4f67c 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/InlineResponse200CreateGameDTO.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/InlineResponse200CreateGameDTO.java @@ -15,9 +15,9 @@ public class InlineResponse200CreateGameDTO { @JsonProperty(value ="code") private Integer code; @JsonProperty(value ="message") - private message; + private MessageDTO message; - private InlineResponse200CreateGameDTO(String description, Integer code, message) { + private InlineResponse200CreateGameDTO(String description, Integer code, MessageDTO message) { this.description = description; this.code = code; this.message = message; @@ -40,7 +40,7 @@ public static class InlineResponse200CreateGameDTOBuilder { private String description; private Integer code; - private message; + private MessageDTO message; public InlineResponse200CreateGameDTO.InlineResponse200CreateGameDTOBuilder description(String description) { this.description = description; @@ -51,7 +51,7 @@ public InlineResponse200CreateGameDTO.InlineResponse200CreateGameDTOBuilder code this.code = code; return this; } - public InlineResponse200CreateGameDTO.InlineResponse200CreateGameDTOBuilder message( message) { + public InlineResponse200CreateGameDTO.InlineResponse200CreateGameDTOBuilder message(MessageDTO message) { this.message = message; return this; } @@ -79,10 +79,10 @@ public void setCode(Integer code) { } @Schema(name = "message", required = false) - public getMessage() { + public MessageDTO getMessage() { return message; } - public void setMessage( message) { + public void setMessage(MessageDTO message) { this.message = message; } diff --git a/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/MessageDTO.java b/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/MessageDTO.java index 56cd8a02..816051a7 100644 --- a/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/MessageDTO.java +++ b/multiapi-engine/src/test/resources/openapigenerator/testMultipleRefGeneration/assets/MessageDTO.java @@ -13,9 +13,9 @@ public class MessageDTO { @JsonProperty(value ="description") private String description; @JsonProperty(value ="message") - private message; + private MessageDTO message; - private MessageDTO(String description, message) { + private MessageDTO(String description, MessageDTO message) { this.description = description; this.message = message; @@ -35,13 +35,13 @@ public static MessageDTO.MessageDTOBuilder builder() { public static class MessageDTOBuilder { private String description; - private message; + private MessageDTO message; public MessageDTO.MessageDTOBuilder description(String description) { this.description = description; return this; } - public MessageDTO.MessageDTOBuilder message( message) { + public MessageDTO.MessageDTOBuilder message(MessageDTO message) { this.message = message; return this; } @@ -61,10 +61,10 @@ public void setDescription(String description) { } @Schema(name = "message", required = false) - public getMessage() { + public MessageDTO getMessage() { return message; } - public void setMessage( message) { + public void setMessage(MessageDTO message) { this.message = message; }