Class CleanEndpointRuleSetParameters

java.lang.Object
software.amazon.smithy.rulesengine.traits.CleanEndpointRuleSetParameters
All Implemented Interfaces:
ModelTransformerPlugin

public final class CleanEndpointRuleSetParameters extends Object implements ModelTransformerPlugin
Removes orphaned endpoint ruleset parameters and their associated rules from a service's @endpointRuleSet trait when operations are removed from the model.

When operations are removed via ModelTransformer.filterShapes(software.amazon.smithy.model.Model, java.util.function.Predicate<software.amazon.smithy.model.shapes.Shape>) or ModelTransformer.removeShapes(software.amazon.smithy.model.Model, java.util.Collection<? extends software.amazon.smithy.model.shapes.Shape>), parameters that were only bound through the removed operations' @staticContextParams, @operationContextParams, or @contextParam traits may become orphaned. To prevent validation failures, this plugin removes those orphaned parameters and prunes any rules that reference them, recompiles the @endpointBdd trait from the cleaned ruleset, and drops @endpointTests cases that reference them.

  • Constructor Details

    • CleanEndpointRuleSetParameters

      public CleanEndpointRuleSetParameters()
  • Method Details

    • onRemove

      public Model onRemove(ModelTransformer transformer, Collection<Shape> removed, Model model)
      Description copied from interface: ModelTransformerPlugin
      The method that is invoked each time shapes are removed from a model.
      Specified by:
      onRemove in interface ModelTransformerPlugin
      Parameters:
      transformer - Transformer used to replace/remove shapes from the model.
      removed - The of shapes that were removed from the model.
      model - Model that has been altered to remove removed.
      Returns:
      Returns a transformed version of the passed in model.