Forum Discussion

yashodhan's avatar
yashodhan
New Contributor
6 years ago

Swagger UI,doesn't give correct object request and response as a example value.

Hiiii,

        I have implemented swagger UI in my application. Everything is working fine but the issue is, 
consider the situation in my API I have different request and response object, but both object's class is annotated with the same json root element name (Ex: @JsonRootName("user")).
For this reason in my swagger UI it gives me same example value in Parameters body and in Responses body. If i remove this @JsonRootName tag from any one class than swagger UI shows me correct example value, but for my application i can't remove this annotation from any class and even can't change the value of it.
I tried many option available on internet but can't resolve my problem. Please help me to resolve this. 
Please refer the attached screens.

 

I have find the issue but  didn't get solution on it ,it related to jackson who always picks the Jackson lib annotation name  (@JsonRootname()),if JsonRootname value name is duplicate in req and resp object then it is overriding the one the object and display same object in req and resp object example value,  instead it should take the model class name.  

 

Thanks, Waiting for your response

No RepliesBe the first to reply