public final List validate()

in oas-validator/oas-validator-compatibility/src/main/java/org/apache/servicecomb/toolkit/oasv/compatibility/validators/schema/SchemaPropertyChangeValidator.java [35:71]


  public final List<OasDiffViolation> validate(OasDiffValidationContext context, OasObjectPropertyLocation leftLocation,
    Schema leftOasObject, OasObjectPropertyLocation rightLocation, Schema rightOasObject) {

    if (!needValidate(context)) {
      return emptyList();
    }

    T leftNumber = getProperty(leftOasObject);
    T rightNumber = getProperty(rightOasObject);

    if (Objects.equals(leftNumber, rightNumber)) {
      return emptyList();
    }

    String propertyName = getPropertyName();

    if (leftNumber == null || rightNumber == null) {
      return singletonList(new OasDiffViolation(
          leftLocation.property(propertyName),
          rightLocation.property(propertyName),
          getMessage(leftNumber, rightNumber)
        )
      );
    }

    if (!isAllowed(leftNumber, rightNumber)) {
      return singletonList(new OasDiffViolation(
          leftLocation.property(propertyName),
          rightLocation.property(propertyName),
          getMessage(leftNumber, rightNumber)
        )
      );
    }

    return emptyList();

  }