I have been testing swagger in order to use it as the defacto documentation for my api service. I am using hibernate for the persistence layer and every response is bound to an entity. The problem is that those entities have dependencies with other entities and I would like to orchestrate swagger to not show those entities when I pass the object in the @ApiOperation response. The only think I could find on line is this link from the github page.
I have tried doing this:
String emptyJSON = "{}";
OverrideConverter addressConverter = new OverrideConverter();
addressConverter.add(User.class.getCanonicalName(), emptyJSON);
ModelConverters.addConverter(addressConverter, true);
but I am getting this error:
org.json4s.package$MappingException: Did not find value which can be converted into java.lang.String
Is there a way to avoid serializing some classes when I find them as fields or in lists and how?
Ok so it appears that you can use
For globally avoiding serialization. Also if you need to avoid inner objects from serializing then just change all the getter methods to something else, seems like swagger is using this the getters and not reflections which sucks in my opinion. Hope that helps