Search in sources :

Example 1 with MultipleTypeDefinition

use of com.reprezen.swagedit.core.schema.MultipleTypeDefinition in project KaiZen-OpenAPI-Editor by RepreZen.

the class ComponentContextType method isReference.

protected boolean isReference(Model model, JsonPointer pointer) {
    AbstractNode contextNode = model.find(pointer);
    if (contextNode == null) {
        return false;
    }
    TypeDefinition type = contextNode.getType();
    if (type instanceof MultipleTypeDefinition) {
        // MultipleTypeDefinition is a special case, it happens when several properties match a property
        for (TypeDefinition nestedType : ((MultipleTypeDefinition) type).getMultipleTypes()) {
            if (getReferencePointerString().equals(nestedType.getPointer().toString())) {
                return true;
            }
        }
    }
    JsonPointer pointerToType = type.getPointer();
    if (pointerToType == null) {
        return false;
    }
    return getReferencePointerString().equals(pointerToType.toString());
}
Also used : MultipleTypeDefinition(com.reprezen.swagedit.core.schema.MultipleTypeDefinition) AbstractNode(com.reprezen.swagedit.core.model.AbstractNode) JsonPointer(com.fasterxml.jackson.core.JsonPointer) MultipleTypeDefinition(com.reprezen.swagedit.core.schema.MultipleTypeDefinition) ComplexTypeDefinition(com.reprezen.swagedit.core.schema.ComplexTypeDefinition) TypeDefinition(com.reprezen.swagedit.core.schema.TypeDefinition)

Aggregations

JsonPointer (com.fasterxml.jackson.core.JsonPointer)1 AbstractNode (com.reprezen.swagedit.core.model.AbstractNode)1 ComplexTypeDefinition (com.reprezen.swagedit.core.schema.ComplexTypeDefinition)1 MultipleTypeDefinition (com.reprezen.swagedit.core.schema.MultipleTypeDefinition)1 TypeDefinition (com.reprezen.swagedit.core.schema.TypeDefinition)1