Given the below pet.yaml definition, when the favorite property of the Tag object is defined first, the XML example is generated correctly. When the favorite property is last, the following error is thrown:
javax.xml.stream.XMLStreamException: Trying to write an attribute when there is no open start element.
at com.ctc.wstx.sw.BaseStreamWriter.throwOutputError(BaseStreamWriter.java:1584)
at com.ctc.wstx.sw.BaseStreamWriter.reportNwfStructure(BaseStreamWriter.java:1613)
at com.ctc.wstx.sw.BaseNsStreamWriter.writeAttribute(BaseNsStreamWriter.java:231)
at io.swagger.oas.inflector.examples.XmlExampleSerializer.writeTo(XmlExampleSerializer.java:160)
at io.swagger.oas.inflector.examples.XmlExampleSerializer.writeTo(XmlExampleSerializer.java:81)
at io.swagger.oas.inflector.examples.XmlExampleSerializer.writeTo(XmlExampleSerializer.java:135)
at io.swagger.oas.inflector.examples.XmlExampleSerializer.writeTo(XmlExampleSerializer.java:81)
at io.swagger.oas.inflector.examples.XmlExampleSerializer.serialize(XmlExampleSerializer.java:39)
at MakeSwaggerExamples.main(MakeSwaggerExamples.java:61)
Exception in thread "main" java.lang.NullPointerException
at java.io.StringReader.<init>(StringReader.java:50)
at MakeSwaggerExamples.main(MakeSwaggerExamples.java:67)
Pet:
type: object
required:
- name
- photoUrls
properties:
id:
type: integer
format: int64
category:
$ref: './category.yaml#/Category'
name:
type: string
example: doggie
photoUrls:
type: array
xml:
name: photoUrl
wrapped: true
items:
type: string
tag:
type: array
xml:
name: tags
wrapped: true
items:
$ref: '#/Tag'
xml:
name: tag
status:
type: string
description: pet status in the store
enum:
- available
- pending
- sold
xml:
name: Pet
Tag:
type: object
properties:
favorite:
type: boolean
xml:
attribute: true
id:
type: integer
format: int64
name:
type: string
xml:
name: tag
Given the below pet.yaml definition, when the
favoriteproperty of theTagobject is defined first, the XML example is generated correctly. When thefavoriteproperty is last, the following error is thrown: