Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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());
}
Expand Down Expand Up @@ -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);
Expand All @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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}}
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/go/go-petstore/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/haskell-http-client/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/feign/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/jersey1/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/jersey2-java8/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/native-async/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/native/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/okhttp-gson/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions samples/client/petstore/java/rest-assured/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading