'Hide autogenerated content of XML annotations in Springfox Api-docs
I am writing a Gradle project with Springfox-swagger-ui 3.0.0 to present nice swagger UI with Api documentation.
compileOnly "io.springfox:springfox-swagger-ui:3.0.0"
One of api endpoints returns a POJO class, that is an auto-generated class from .xsd schema using XJC task.
What I'd like to do is to prevent Swagger from including auto-generated Xml-annotations
Example POJO class (generated from xsd schema):
@Getter
public class TestPojo {
@XmlElement(required = true)
protected String machineSerialNumber;
}
Generated api-docs:
"TestPojo": {
"type": "object",
"title": "TestPojo",
"properties": {
"machineSerialNumber": {
"type": "string",
"xml": {
"name": "machineSerialNumber",
"attribute": false,
"wrapped": false
}
}
}
}
What I'd like to achieve, is to not present these xml-annotations, so that api-docs content will look like this:
"TestPojo": {
"type": "object",
"properties": {
"machineSerialNumber": {
"type": "string"
}
},
"title": "TestPojo"
}
And swagger-ui model:
The problem here is that I cannot change the content of auto-generated classes to remove these annotations. Is there a way to configure Swagger in a way so that it skips these annotations?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|


