All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.swagger.validator.models.SchemaValidationError Maven / Gradle / Ivy

There is a newer version: 1.0.7
Show newest version
package io.swagger.validator.models;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ArrayNode;

import java.util.List;

public class SchemaValidationError {
    private String level, domain, keyword, message;
    private Schema schema;
    private Instance instance;
    private List required;
    private List missing;

    public SchemaValidationError() {
    }

    public SchemaValidationError(JsonNode node) {
        JsonNode prop = node.get("level");
        if (prop != null) {
            level = prop.asText();
        }

        prop = node.get("domain");
        if (prop != null) {
            domain = prop.asText();
        }

        prop = node.get("keyword");
        if (prop != null) {
            keyword = prop.asText();
        }

        prop = node.get("message");
        if (prop != null) {
            message = prop.asText();
        }

        prop = node.get("schema");
        if (prop != null) {
            schema = new Schema();
            JsonNode s = prop;
            prop = s.get("loadingURI");
            if (prop != null) {
                schema.setLoadingURI(prop.asText());
            }
            prop = s.get("pointer");
            if (prop != null) {
                schema.setPointer(prop.asText());
            }
        }

        prop = node.get("instance");
        if (prop != null) {
            instance = new Instance();
            JsonNode s = prop;
            prop = s.get("pointer");
            if (prop != null) {
                instance.setPointer(prop.asText());
            }
        }

        prop = node.get("required");
        if (prop != null && prop.isArray()) {
            ArrayNode an = (ArrayNode) prop;
        }
    }

    public String getLevel() {
        return level;
    }

    public void setLevel(String level) {
        this.level = level;
    }

    public String getDomain() {
        return domain;
    }

    public void setDomain(String domain) {
        this.domain = domain;
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = keyword;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public List getRequired() {
        return required;
    }

    public void setRequired(List required) {
        this.required = required;
    }

    public List getMissing() {
        return missing;
    }

    public void setMissing(List missing) {
        this.missing = missing;
    }

    public Schema getSchema() {
        return schema;
    }

    public void setSchema(Schema schema) {
        this.schema = schema;
    }

    public Instance getInstance() {
        return instance;
    }

    public void setInstance(Instance instance) {
        this.instance = instance;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy