I am currently trying to map a swagger.json file to a io.swagger.models.Swagger.class. I've tried to use com.fasterxml.jackson.databind.ObjectMapper.class to solve the issue by :
new ObjectMapper().readValue(file.getInputStream(), Swagger.class)` but i got this exception:
"InvalidDefinitionException: Cannot construct instance of io.swagger.models.parameters.Parameter (no Creators, like default construct, exist): abstract types either need to be mapped to concrete types, have custom deserializer, or contain additional type information at [Source: (FileInputStream); line: 28, column: 21] (through reference chain: io.swagger.models.Swagger["paths"]->java.util.LinkedHashMap["/myPath"]->io.swagger.models.Path["post"]->io.swagger.models.Operation["parameters"]->java.util.ArrayList[0])" The problem is that the parameters field in Swagger class goes like this :
protected Map<String, Parameter> parameters;
Parameter here is an Interface, so the ObjectMapper doesn't know which class to instantiate (BodyParameter, PathParameter, FormParameter...)
I expect to load a swagger.json file into a Swagger Object.
Thank you for your help.