I have below schema.
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name="sampleRequest">
<xs:complexType>
<xs:sequence>
<xs:element name="Lookup" minOccurs="0">
<xs:complexType>
<xs:sequence>
<xs:element name="accountidtgroup">
<xs:complexType>
<xs:sequence>
<xs:element name="accountIDType" type="xs:string" />
<xs:element name="accountIDValue" type="xs:string" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sysPlanID" type="xs:string"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="sampleResponse">
<xs:complexType>
<xs:sequence>
<xs:element name="Dummy" type="xs:string"/>
<xs:element name="OriginalReq">
<xs:complexType>
<xs:sequence>
<xs:element ref="sampleRequest"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
I generate classes out of it and all works fine except that the case of "Lookup" elements gets converted to lowercase(Technically speaking, it's the object name) in Swagger UI while it should actually be "Lookup". If I just remove/comment out the "OriginalReq" element in the sampleRequest, rebuild and restart my application, the case of "Lookup" element appears fine in the request. The important thing to notice here that "OriginalReq" element is actually a reference to the "sampleRequest" element itself and this is the root cause of the issue.
Here are my pom dependencies
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
I did some investigation and earlier versions of springfox had issues with Jaxb annotations but it was fixed in later versions. The proof of which is that "Dummy" element in response appears in correct case and if I manually change it to something else in @XmlElement annotation, I can see the updated value which means that the annotation was honored but for Lookup element it doesn't work. So the issue is only in case of nested element having common element.
Has anyone run into similar issue before or if there is a workaround?