Class ModifiedTrait

java.lang.Object
software.amazon.smithy.diff.evaluators.AbstractDiffEvaluator
software.amazon.smithy.diff.evaluators.ModifiedTrait
All Implemented Interfaces:
DiffEvaluator

public final class ModifiedTrait extends AbstractDiffEvaluator
Finds breaking changes related to when a trait is added, removed, or updated.

Note that the use of special diff tags is deprecated in favor of using the breakingChanges property of a trait definition. See TraitBreakingChange.

This evaluator looks for trait definitions with specific tags. When traits that use these tags are added, removed, or updated, a validation event is emitted for the change. This uses honors the following tags:

  • diff.error.add: It is an error to add a trait to an existing shape or to add a member to a nested trait value.
  • diff.error.remove: It is an error to remove this trait from a shape or to remove a member from a nested trait value.
  • diff.error.update: It is an error to change the value of this shape or a member of a nested trait value.
  • diff.error.const: It is an error to add, remove, or update a trait or a member of a nested trait value.
  • diff.danger.add: It is a danger to add a trait to an existing shape or to add a member to a nested trait value.
  • diff.danger.remove: It is a danger to remove this trait from a shape or to remove a member from a nested trait value.
  • diff.danger.update: It is a danger to change the value of this shape or a member of a nested trait value.
  • diff.danger.const: It is a danger to add, remove, or update a trait or a member of a nested trait value.
  • diff.warning.add: It is a warning to add a trait to an existing shape or to add a member to a nested trait value.
  • diff.warning.remove: It is a warning to remove this trait from a shape or to remove a member from a nested trait value.
  • diff.warning.update: It is a warning to change the value of this shape or a member of a nested trait value.
  • diff.warning.const: It is a warning to add, remove, or update a trait or a member of a nested trait value.
  • diff.contents: Inspect the nested contents of a trait using diff tags.
  • Constructor Details

    • ModifiedTrait

      public ModifiedTrait()
  • Method Details

    • evaluate

      public List<ValidationEvent> evaluate(Differences differences)
      Description copied from interface: DiffEvaluator
      Returns validation events given two models and the detected differences between them.
      Parameters:
      differences - Detected differences.
      Returns:
      Returns validation events that are relative to the new model.