All Downloads are FREE. Search and download functionalities are using the official Maven repository.

smithy.waiters.PathMatcher.scala Maven / Gradle / Ivy

There is a newer version: 0.19.0-41-91762fb
Show newest version
package smithy.waiters

import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct

/** Defines how to test the result of a JMESPath expression against
  * an expected value.
  * @param path
  *   A JMESPath expression applied to the input or output of an operation.
  * @param expected
  *   The expected return value of the expression.
  * @param comparator
  *   The comparator used to compare the result of the expression with the
  *   expected value.
  */
final case class PathMatcher(path: String, expected: String, comparator: PathComparator)

object PathMatcher extends ShapeTag.Companion[PathMatcher] {
  val id: ShapeId = ShapeId("smithy.waiters", "PathMatcher")

  val hints: Hints = Hints(
    smithy.api.Documentation("Defines how to test the result of a JMESPath expression against\nan expected value."),
    smithy.api.Private(),
  ).lazily

  // constructor using the original order from the spec
  private def make(path: String, expected: String, comparator: PathComparator): PathMatcher = PathMatcher(path, expected, comparator)

  implicit val schema: Schema[PathMatcher] = struct(
    string.required[PathMatcher]("path", _.path).addHints(smithy.api.Documentation("A JMESPath expression applied to the input or output of an operation.")),
    string.required[PathMatcher]("expected", _.expected).addHints(smithy.api.Documentation("The expected return value of the expression.")),
    PathComparator.schema.required[PathMatcher]("comparator", _.comparator).addHints(smithy.api.Documentation("The comparator used to compare the result of the expression with the\nexpected value.")),
  )(make).withId(id).addHints(hints)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy