kab/kab/static/js/monaco-yaml/yamlWorker.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 {
      var 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 { var 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