update/plugins/org.eclipse.wildwebdeveloper_0.5.8.202005190736/node_modules/yaml-language-server/out/server/src/languageservice/parser/jsonParser04.js
//genericComparison tries to find the best matching schema using a generic comparison
genericComparison tries to find the best matching schema using a generic comparison
genericComparison tries to find the best matching schema using a generic comparison
function genericComparison(maxOneMatch, subValidationResult, bestMatch, subSchema, subMatchingSchemas) {
    if (!maxOneMatch && !subValidationResult.hasProblems() && !bestMatch.validationResult.hasProblems()) {
        bestMatch.matchingSchemas.merge(subMatchingSchemas);
        bestMatch.validationResult.propertiesMatches += subValidationResult.propertiesMatches;
        bestMatch.validationResult.propertiesValueMatches += subValidationResult.propertiesValueMatches;
    }
    else {
        const compareResult = subValidationResult.compareGeneric(bestMatch.validationResult);
        if (compareResult > 0) {
            bestMatch = { schema: subSchema, validationResult: subValidationResult, matchingSchemas: subMatchingSchemas };
        }
        else if (compareResult === 0) {
            bestMatch.matchingSchemas.merge(subMatchingSchemas);
            bestMatch.validationResult.mergeEnumValues(subValidationResult);
        }
    }
    return bestMatch;
}
function genericComparison ( maxOneMatch , subValidationResult , bestMatch , subSchema , subMatchingSchemas ) { if ( ! maxOneMatch && ! subValidationResult . hasProblems ( ) && ! bestMatch . validationResult . hasProblems ( ) ) { bestMatch . matchingSchemas . merge ( subMatchingSchemas ) ; bestMatch . validationResult . propertiesMatches += subValidationResult . propertiesMatches ; bestMatch . validationResult . propertiesValueMatches += subValidationResult . propertiesValueMatches ; } else { const compareResult = subValidationResult . compareGeneric ( bestMatch . validationResult ) ; if ( compareResult > 0 ) { bestMatch = { schema : subSchema , validationResult : subValidationResult , matchingSchemas : subMatchingSchemas } ; } else if ( compareResult === 0 ) { bestMatch . matchingSchemas . merge ( subMatchingSchemas ) ; bestMatch . validationResult . mergeEnumValues ( subValidationResult ) ; } } return bestMatch ; }
genericComparison tries to find the best matching schema using a generic comparison
genericComparison tries to find the best matching schema using a generic comparison
// no errors, both are equally good matches // our node is the best matching so far // there's already a best matching but we are as good