io.swagger.models.reader.SwaggerParser Maven / Gradle / Ivy
package io.swagger.models.reader;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import io.swagger.models.AuthorizationScope;
import io.swagger.report.Message;
import io.swagger.report.MessageBuilder;
import io.swagger.report.Severity;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public abstract class SwaggerParser {
ObjectMapper mapper = new ObjectMapper();
protected SwaggerParser() {
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
mapper.disable(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS);
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
}
protected String readString(Object object) {
String value = null;
if (object != null) {
value = object.toString();
}
return value;
}
protected Boolean readBoolean(Object object) {
Boolean value = null;
if (object != null) {
// TODO: Handle parsing error
value = Boolean.parseBoolean(object.toString());
}
return value;
}
protected Integer readInteger(Object object) {
Integer value = null;
if (object != null) {
// TODO: Handle parsing error
value = Integer.parseInt(object.toString());
}
return value;
}
protected List readAuthorizationScopes(List