diff --git a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java index 92a3f76b7600..6e9fa82f8b0e 100644 --- a/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java +++ b/modules/openapi-generator/src/main/java/org/openapitools/codegen/DefaultCodegen.java @@ -3027,14 +3027,6 @@ public CodegenProperty fromProperty(String name, Schema p) { property.isNullable = p.getNullable(); } - if (p.getXml() != null) { - if (p.getXml().getAttribute() != null) { - property.isXmlAttribute = p.getXml().getAttribute(); - } - property.xmlPrefix = p.getXml().getPrefix(); - property.xmlName = p.getXml().getName(); - property.xmlNamespace = p.getXml().getNamespace(); - } if (p.getExtensions() != null && !p.getExtensions().isEmpty()) { property.getVendorExtensions().putAll(p.getExtensions()); } @@ -3199,6 +3191,32 @@ public CodegenProperty fromProperty(String name, Schema p) { property.isNullable = referencedSchema.getNullable(); } + final XML referencedSchemaXml = referencedSchema.getXml(); + + if (referencedSchemaXml != null) { + property.xmlName = referencedSchemaXml.getName(); + property.xmlNamespace = referencedSchemaXml.getNamespace(); + property.xmlPrefix = referencedSchemaXml.getPrefix(); + if (referencedSchemaXml.getAttribute() != null) { + property.isXmlAttribute = referencedSchemaXml.getAttribute(); + } + if (referencedSchemaXml.getWrapped() != null) { + property.isXmlWrapped = referencedSchemaXml.getWrapped(); + } + } + + if (p.getXml() != null) { + if (p.getXml().getAttribute() != null) { + property.isXmlAttribute = p.getXml().getAttribute(); + } + if (p.getXml().getWrapped() != null) { + property.isXmlWrapped = p.getXml().getWrapped(); + } + property.xmlPrefix = p.getXml().getPrefix(); + property.xmlName = p.getXml().getName(); + property.xmlNamespace = p.getXml().getNamespace(); + } + property.dataType = getTypeDeclaration(p); property.dataFormat = p.getFormat(); property.baseType = getSchemaType(p); @@ -3220,12 +3238,6 @@ public CodegenProperty fromProperty(String name, Schema p) { property.containerType = "array"; } property.baseType = getSchemaType(p); - if (p.getXml() != null) { - property.isXmlWrapped = p.getXml().getWrapped() == null ? false : p.getXml().getWrapped(); - property.xmlPrefix = p.getXml().getPrefix(); - property.xmlNamespace = p.getXml().getNamespace(); - property.xmlName = p.getXml().getName(); - } // handle inner property property.maxItems = p.getMaxItems(); diff --git a/modules/openapi-generator/src/main/resources/Java/jackson_annotations.mustache b/modules/openapi-generator/src/main/resources/Java/jackson_annotations.mustache index ac01b293cc12..43925cd7877b 100644 --- a/modules/openapi-generator/src/main/resources/Java/jackson_annotations.mustache +++ b/modules/openapi-generator/src/main/resources/Java/jackson_annotations.mustache @@ -11,9 +11,8 @@ @JacksonXmlProperty({{#isXmlAttribute}}isAttribute = true, {{/isXmlAttribute}}{{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}") {{/isContainer}} {{#isContainer}} - {{#isXmlWrapped}} // items.xmlName={{items.xmlName}} - @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}, {{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{items.baseName}}{{/items.xmlName}}") - {{/isXmlWrapped}} + @JacksonXmlProperty({{#xmlNamespace}}namespace="{{xmlNamespace}}", {{/xmlNamespace}}localName = "{{#items.xmlName}}{{items.xmlName}}{{/items.xmlName}}{{^items.xmlName}}{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}{{/items.xmlName}}") + @JacksonXmlElementWrapper(useWrapping = {{isXmlWrapped}}{{#xmlNamespace}}, namespace="{{xmlNamespace}}"{{/xmlNamespace}}{{#isXmlWrapped}}, localName = "{{#xmlName}}{{xmlName}}{{/xmlName}}{{^xmlName}}{{baseName}}{{/xmlName}}"{{/isXmlWrapped}}) {{/isContainer}} {{/withXml}} \ No newline at end of file diff --git a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml index 27083db4ad70..d4a69ff53094 100644 --- a/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml +++ b/modules/openapi-generator/src/test/resources/2_0/petstore-with-fake-endpoints-models-for-testing.yaml @@ -1238,14 +1238,15 @@ definitions: type: array uniqueItems: true xml: - name: photoUrl wrapped: true items: type: string + xml: + name: photoUrl tags: type: array xml: - name: tag + name: tags wrapped: true items: $ref: '#/definitions/Tag' diff --git a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml index 2fe0565e0a54..188ddfc817cd 100644 --- a/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go-experimental/go-petstore/api/openapi.yaml @@ -1325,17 +1325,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml index 2fe0565e0a54..188ddfc817cd 100644 --- a/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore-withXml/api/openapi.yaml @@ -1325,17 +1325,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/go/go-petstore/api/openapi.yaml b/samples/client/petstore/go/go-petstore/api/openapi.yaml index 2fe0565e0a54..188ddfc817cd 100644 --- a/samples/client/petstore/go/go-petstore/api/openapi.yaml +++ b/samples/client/petstore/go/go-petstore/api/openapi.yaml @@ -1325,17 +1325,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/haskell-http-client/openapi.yaml b/samples/client/petstore/haskell-http-client/openapi.yaml index 2fe0565e0a54..188ddfc817cd 100644 --- a/samples/client/petstore/haskell-http-client/openapi.yaml +++ b/samples/client/petstore/haskell-http-client/openapi.yaml @@ -1325,17 +1325,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/feign/api/openapi.yaml b/samples/client/petstore/java/feign/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/feign/api/openapi.yaml +++ b/samples/client/petstore/java/feign/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/google-api-client/api/openapi.yaml b/samples/client/petstore/java/google-api-client/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/google-api-client/api/openapi.yaml +++ b/samples/client/petstore/java/google-api-client/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/jersey1/api/openapi.yaml b/samples/client/petstore/java/jersey1/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/jersey1/api/openapi.yaml +++ b/samples/client/petstore/java/jersey1/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/jersey2-java8/api/openapi.yaml b/samples/client/petstore/java/jersey2-java8/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/jersey2-java8/api/openapi.yaml +++ b/samples/client/petstore/java/jersey2-java8/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/native-async/api/openapi.yaml b/samples/client/petstore/java/native-async/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/native-async/api/openapi.yaml +++ b/samples/client/petstore/java/native-async/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/native/api/openapi.yaml b/samples/client/petstore/java/native/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/native/api/openapi.yaml +++ b/samples/client/petstore/java/native/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/okhttp-gson-parcelableModel/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson-parcelableModel/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/okhttp-gson-parcelableModel/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson-parcelableModel/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/okhttp-gson/api/openapi.yaml +++ b/samples/client/petstore/java/okhttp-gson/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/rest-assured-jackson/api/openapi.yaml b/samples/client/petstore/java/rest-assured-jackson/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/rest-assured-jackson/api/openapi.yaml +++ b/samples/client/petstore/java/rest-assured-jackson/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/rest-assured/api/openapi.yaml b/samples/client/petstore/java/rest-assured/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/rest-assured/api/openapi.yaml +++ b/samples/client/petstore/java/rest-assured/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/resteasy/api/openapi.yaml b/samples/client/petstore/java/resteasy/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/resteasy/api/openapi.yaml +++ b/samples/client/petstore/java/resteasy/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate-withXml/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java index 9c8e03cc6fa3..daa8c5f5d375 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/AdditionalPropertiesClass.java @@ -143,6 +143,9 @@ public AdditionalPropertiesClass putMapStringItem(String key, String mapStringIt @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_string") + @JacksonXmlElementWrapper(useWrapping = false) public Map getMapString() { return mapString; @@ -176,6 +179,9 @@ public AdditionalPropertiesClass putMapNumberItem(String key, BigDecimal mapNumb @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_number") + @JacksonXmlElementWrapper(useWrapping = false) public Map getMapNumber() { return mapNumber; @@ -209,6 +215,9 @@ public AdditionalPropertiesClass putMapIntegerItem(String key, Integer mapIntege @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_integer") + @JacksonXmlElementWrapper(useWrapping = false) public Map getMapInteger() { return mapInteger; @@ -242,6 +251,9 @@ public AdditionalPropertiesClass putMapBooleanItem(String key, Boolean mapBoolea @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_BOOLEAN) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_boolean") + @JacksonXmlElementWrapper(useWrapping = false) public Map getMapBoolean() { return mapBoolean; @@ -275,6 +287,9 @@ public AdditionalPropertiesClass putMapArrayIntegerItem(String key, List> getMapArrayInteger() { return mapArrayInteger; @@ -308,6 +323,9 @@ public AdditionalPropertiesClass putMapArrayAnytypeItem(String key, List @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_ARRAY_ANYTYPE) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_array_anytype") + @JacksonXmlElementWrapper(useWrapping = false) public Map> getMapArrayAnytype() { return mapArrayAnytype; @@ -341,6 +359,9 @@ public AdditionalPropertiesClass putMapMapStringItem(String key, Map> getMapMapString() { return mapMapString; @@ -374,6 +395,9 @@ public AdditionalPropertiesClass putMapMapAnytypeItem(String key, Map> getMapMapAnytype() { return mapMapAnytype; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java index 419372fe6521..3c08e8da4dbf 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfArrayOfNumberOnly.java @@ -71,6 +71,9 @@ public ArrayOfArrayOfNumberOnly addArrayArrayNumberItem(List arrayAr @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "ArrayArrayNumber") + @JacksonXmlElementWrapper(useWrapping = false) public List> getArrayArrayNumber() { return arrayArrayNumber; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java index 3b5fc5fce8b9..782298303908 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayOfNumberOnly.java @@ -71,6 +71,9 @@ public ArrayOfNumberOnly addArrayNumberItem(BigDecimal arrayNumberItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_NUMBER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "ArrayNumber") + @JacksonXmlElementWrapper(useWrapping = false) public List getArrayNumber() { return arrayNumber; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java index e48085b5ed50..1c318f28534a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/ArrayTest.java @@ -87,6 +87,9 @@ public ArrayTest addArrayOfStringItem(String arrayOfStringItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_OF_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "array_of_string") + @JacksonXmlElementWrapper(useWrapping = false) public List getArrayOfString() { return arrayOfString; @@ -120,6 +123,9 @@ public ArrayTest addArrayArrayOfIntegerItem(List arrayArrayOfIntegerItem) @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_INTEGER) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "array_array_of_integer") + @JacksonXmlElementWrapper(useWrapping = false) public List> getArrayArrayOfInteger() { return arrayArrayOfInteger; @@ -153,6 +159,9 @@ public ArrayTest addArrayArrayOfModelItem(List arrayArrayOfModelI @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ARRAY_OF_MODEL) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "array_array_of_model") + @JacksonXmlElementWrapper(useWrapping = false) public List> getArrayArrayOfModel() { return arrayArrayOfModel; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java index 3fc53e70aaab..7f2158310a34 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/EnumArrays.java @@ -171,6 +171,9 @@ public EnumArrays addArrayEnumItem(ArrayEnumEnum arrayEnumItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ENUM) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "array_enum") + @JacksonXmlElementWrapper(useWrapping = false) public List getArrayEnum() { return arrayEnum; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java index b780bd75ddf5..4ae7856e4475 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/FileSchemaTestClass.java @@ -101,6 +101,9 @@ public FileSchemaTestClass addFilesItem(java.io.File filesItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_FILES) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "files") + @JacksonXmlElementWrapper(useWrapping = false) public List getFiles() { return files; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java index dfe553a53b46..72c5f054f05c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MapTest.java @@ -130,6 +130,9 @@ public MapTest putMapMapOfStringItem(String key, Map mapMapOfStr @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_MAP_OF_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_map_of_string") + @JacksonXmlElementWrapper(useWrapping = false) public Map> getMapMapOfString() { return mapMapOfString; @@ -163,6 +166,9 @@ public MapTest putMapOfEnumStringItem(String key, InnerEnum mapOfEnumStringItem) @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP_OF_ENUM_STRING) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map_of_enum_string") + @JacksonXmlElementWrapper(useWrapping = false) public Map getMapOfEnumString() { return mapOfEnumString; @@ -196,6 +202,9 @@ public MapTest putDirectMapItem(String key, Boolean directMapItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_DIRECT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "direct_map") + @JacksonXmlElementWrapper(useWrapping = false) public Map getDirectMap() { return directMap; @@ -229,6 +238,9 @@ public MapTest putIndirectMapItem(String key, Boolean indirectMapItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_INDIRECT_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "indirect_map") + @JacksonXmlElementWrapper(useWrapping = false) public Map getIndirectMap() { return indirectMap; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java index baa0706b4487..e0da5d28a4a5 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/MixedPropertiesAndAdditionalPropertiesClass.java @@ -136,6 +136,9 @@ public MixedPropertiesAndAdditionalPropertiesClass putMapItem(String key, Animal @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_MAP) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "map") + @JacksonXmlElementWrapper(useWrapping = false) public Map getMap() { return map; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java index 0424303b0767..5c54ff3b622a 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/Pet.java @@ -54,7 +54,7 @@ public class Pet { private Long id; public static final String JSON_PROPERTY_CATEGORY = "category"; - @XmlElement(name = "category") + @XmlElement(name = "Category") private Category category; public static final String JSON_PROPERTY_NAME = "name"; @@ -63,18 +63,18 @@ public class Pet { public static final String JSON_PROPERTY_PHOTO_URLS = "photoUrls"; // Is a container wrapped=true - // items.name=photoUrls items.baseName=photoUrls items.xmlName= items.xmlNamespace= + // items.name=photoUrls items.baseName=photoUrls items.xmlName=photoUrl items.xmlNamespace= // items.example= items.type=String - @XmlElement(name = "photoUrls") - @XmlElementWrapper(name = "photoUrl") + @XmlElement(name = "photoUrl") + @XmlElementWrapper(name = "photoUrls") private Set photoUrls = new LinkedHashSet(); public static final String JSON_PROPERTY_TAGS = "tags"; // Is a container wrapped=true - // items.name=tags items.baseName=tags items.xmlName= items.xmlNamespace= + // items.name=tags items.baseName=tags items.xmlName=Tag items.xmlNamespace= // items.example= items.type=Tag - @XmlElement(name = "tags") - @XmlElementWrapper(name = "tag") + @XmlElement(name = "Tag") + @XmlElementWrapper(name = "tags") private List tags = null; /** @@ -159,7 +159,7 @@ public Pet category(Category category) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_CATEGORY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - @JacksonXmlProperty(localName = "category") + @JacksonXmlProperty(localName = "Category") public Category getCategory() { return category; @@ -214,7 +214,8 @@ public Pet addPhotoUrlsItem(String photoUrlsItem) { @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_PHOTO_URLS) @JsonInclude(value = JsonInclude.Include.ALWAYS) - // items.xmlName= + // items.xmlName=photoUrl + @JacksonXmlProperty(localName = "photoUrl") @JacksonXmlElementWrapper(useWrapping = true, localName = "photoUrls") public Set getPhotoUrls() { @@ -249,7 +250,8 @@ public Pet addTagsItem(Tag tagsItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_TAGS) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) - // items.xmlName= + // items.xmlName=Tag + @JacksonXmlProperty(localName = "Tag") @JacksonXmlElementWrapper(useWrapping = true, localName = "tags") public List getTags() { diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java index 194b3f5945fc..2fb0d3fc660b 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderDefault.java @@ -187,6 +187,9 @@ public TypeHolderDefault addArrayItemItem(Integer arrayItemItem) { @ApiModelProperty(required = true, value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) @JsonInclude(value = JsonInclude.Include.ALWAYS) + // items.xmlName= + @JacksonXmlProperty(localName = "array_item") + @JacksonXmlElementWrapper(useWrapping = false) public List getArrayItem() { return arrayItem; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java index f92547fa4ae9..0fabecb426b5 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/TypeHolderExample.java @@ -217,6 +217,9 @@ public TypeHolderExample addArrayItemItem(Integer arrayItemItem) { @ApiModelProperty(example = "[0, 1, 2, 3]", required = true, value = "") @JsonProperty(JSON_PROPERTY_ARRAY_ITEM) @JsonInclude(value = JsonInclude.Include.ALWAYS) + // items.xmlName= + @JacksonXmlProperty(localName = "array_item") + @JacksonXmlElementWrapper(useWrapping = false) public List getArrayItem() { return arrayItem; diff --git a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java index e52e67606a14..f9acf0919f8c 100644 --- a/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java +++ b/samples/client/petstore/java/resttemplate-withXml/src/main/java/org/openapitools/client/model/XmlItem.java @@ -345,7 +345,8 @@ public XmlItem addWrappedArrayItem(Integer wrappedArrayItem) { @JsonProperty(JSON_PROPERTY_WRAPPED_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) // items.xmlName= - @JacksonXmlElementWrapper(useWrapping = true, localName = "wrappedArray") + @JacksonXmlProperty(localName = "wrapped_array") + @JacksonXmlElementWrapper(useWrapping = true, localName = "wrapped_array") public List getWrappedArray() { return wrappedArray; @@ -483,6 +484,9 @@ public XmlItem addNameArrayItem(Integer nameArrayItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAME_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName=xml_name_array_item + @JacksonXmlProperty(localName = "xml_name_array_item") + @JacksonXmlElementWrapper(useWrapping = false) public List getNameArray() { return nameArray; @@ -517,7 +521,8 @@ public XmlItem addNameWrappedArrayItem(Integer nameWrappedArrayItem) { @JsonProperty(JSON_PROPERTY_NAME_WRAPPED_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) // items.xmlName=xml_name_wrapped_array_item - @JacksonXmlElementWrapper(useWrapping = true, localName = "xml_name_wrapped_array_item") + @JacksonXmlProperty(localName = "xml_name_wrapped_array_item") + @JacksonXmlElementWrapper(useWrapping = true, localName = "xml_name_wrapped_array") public List getNameWrappedArray() { return nameWrappedArray; @@ -655,6 +660,9 @@ public XmlItem addPrefixArrayItem(Integer prefixArrayItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PREFIX_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "prefix_array") + @JacksonXmlElementWrapper(useWrapping = false) public List getPrefixArray() { return prefixArray; @@ -689,7 +697,8 @@ public XmlItem addPrefixWrappedArrayItem(Integer prefixWrappedArrayItem) { @JsonProperty(JSON_PROPERTY_PREFIX_WRAPPED_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) // items.xmlName= - @JacksonXmlElementWrapper(useWrapping = true, localName = "prefixWrappedArray") + @JacksonXmlProperty(localName = "prefix_wrapped_array") + @JacksonXmlElementWrapper(useWrapping = true, localName = "prefix_wrapped_array") public List getPrefixWrappedArray() { return prefixWrappedArray; @@ -827,6 +836,9 @@ public XmlItem addNamespaceArrayItem(Integer namespaceArrayItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_NAMESPACE_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "namespace_array") + @JacksonXmlElementWrapper(useWrapping = false) public List getNamespaceArray() { return namespaceArray; @@ -861,7 +873,8 @@ public XmlItem addNamespaceWrappedArrayItem(Integer namespaceWrappedArrayItem) { @JsonProperty(JSON_PROPERTY_NAMESPACE_WRAPPED_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) // items.xmlName= - @JacksonXmlElementWrapper(useWrapping = true, namespace="http://f.com/schema", localName = "namespaceWrappedArray") + @JacksonXmlProperty(namespace="http://f.com/schema", localName = "namespace_wrapped_array") + @JacksonXmlElementWrapper(useWrapping = true, namespace="http://f.com/schema", localName = "namespace_wrapped_array") public List getNamespaceWrappedArray() { return namespaceWrappedArray; @@ -999,6 +1012,9 @@ public XmlItem addPrefixNsArrayItem(Integer prefixNsArrayItem) { @ApiModelProperty(value = "") @JsonProperty(JSON_PROPERTY_PREFIX_NS_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) + // items.xmlName= + @JacksonXmlProperty(localName = "prefix_ns_array") + @JacksonXmlElementWrapper(useWrapping = false) public List getPrefixNsArray() { return prefixNsArray; @@ -1033,7 +1049,8 @@ public XmlItem addPrefixNsWrappedArrayItem(Integer prefixNsWrappedArrayItem) { @JsonProperty(JSON_PROPERTY_PREFIX_NS_WRAPPED_ARRAY) @JsonInclude(value = JsonInclude.Include.USE_DEFAULTS) // items.xmlName= - @JacksonXmlElementWrapper(useWrapping = true, namespace="http://f.com/schema", localName = "prefixNsWrappedArray") + @JacksonXmlProperty(namespace="http://f.com/schema", localName = "prefix_ns_wrapped_array") + @JacksonXmlElementWrapper(useWrapping = true, namespace="http://f.com/schema", localName = "prefix_ns_wrapped_array") public List getPrefixNsWrappedArray() { return prefixNsWrappedArray; diff --git a/samples/client/petstore/java/resttemplate/api/openapi.yaml b/samples/client/petstore/java/resttemplate/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/resttemplate/api/openapi.yaml +++ b/samples/client/petstore/java/resttemplate/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/retrofit2-play26/api/openapi.yaml b/samples/client/petstore/java/retrofit2-play26/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/retrofit2-play26/api/openapi.yaml +++ b/samples/client/petstore/java/retrofit2-play26/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/retrofit2/api/openapi.yaml b/samples/client/petstore/java/retrofit2/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/retrofit2/api/openapi.yaml +++ b/samples/client/petstore/java/retrofit2/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/retrofit2rx2/api/openapi.yaml b/samples/client/petstore/java/retrofit2rx2/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/retrofit2rx2/api/openapi.yaml +++ b/samples/client/petstore/java/retrofit2rx2/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/retrofit2rx3/api/openapi.yaml b/samples/client/petstore/java/retrofit2rx3/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/retrofit2rx3/api/openapi.yaml +++ b/samples/client/petstore/java/retrofit2rx3/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/vertx/api/openapi.yaml b/samples/client/petstore/java/vertx/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/vertx/api/openapi.yaml +++ b/samples/client/petstore/java/vertx/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/client/petstore/java/webclient/api/openapi.yaml b/samples/client/petstore/java/webclient/api/openapi.yaml index 00cc0f2f4c26..b8ecd7c4345b 100644 --- a/samples/client/petstore/java/webclient/api/openapi.yaml +++ b/samples/client/petstore/java/webclient/api/openapi.yaml @@ -1386,17 +1386,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json b/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json index f5f2da4a9437..e13dfc0df93b 100644 --- a/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json +++ b/samples/server/petstore/java-play-framework-fake-endpoints/public/openapi.json @@ -1797,12 +1797,14 @@ }, "photoUrls" : { "items" : { - "type" : "string" + "type" : "string", + "xml" : { + "name" : "photoUrl" + } }, "type" : "array", "uniqueItems" : true, "xml" : { - "name" : "photoUrl", "wrapped" : true } }, @@ -1812,7 +1814,7 @@ }, "type" : "array", "xml" : { - "name" : "tag", + "name" : "tags", "wrapped" : true } }, diff --git a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml index 7d1bd12ec826..c487a85bfead 100644 --- a/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec-interface/src/main/openapi/openapi.yaml @@ -1460,17 +1460,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml index 7d1bd12ec826..c487a85bfead 100644 --- a/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml +++ b/samples/server/petstore/jaxrs-spec/src/main/openapi/openapi.yaml @@ -1460,17 +1460,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store diff --git a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml index 7d1bd12ec826..c487a85bfead 100644 --- a/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml +++ b/samples/server/petstore/springboot-reactive/src/main/resources/openapi.yaml @@ -1460,17 +1460,18 @@ components: photoUrls: items: type: string + xml: + name: photoUrl type: array uniqueItems: true xml: - name: photoUrl wrapped: true tags: items: $ref: '#/components/schemas/Tag' type: array xml: - name: tag + name: tags wrapped: true status: description: pet status in the store