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

smithy4s.smithy.rules.EndpointTest.scala Maven / Gradle / Ivy

The newest version!
package smithy.rules

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

/** Describes an endpoint test case for validation of an endpoint rule-set.
  * @param documentation
  *   Documentation describing the test case.
  * @param params
  *   Defines rule-set parameters and values to use for testing rules-engine.
  * @param operationInputs
  *   Defines a set of service operation configurations used for testing the rules-engine.
  * @param expect
  *   The expected outcome of the test case.
  */
final case class EndpointTest(expect: EndpointTestExpectation, documentation: Option[String] = None, params: Option[Document] = None, operationInputs: Option[List[OperationInput]] = None)

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

  val hints: Hints = Hints(
    smithy.api.Documentation("Describes an endpoint test case for validation of an endpoint rule-set."),
    smithy.api.Unstable(),
    smithy.api.Private(),
  ).lazily

  // constructor using the original order from the spec
  private def make(documentation: Option[String], params: Option[Document], operationInputs: Option[List[OperationInput]], expect: EndpointTestExpectation): EndpointTest = EndpointTest(expect, documentation, params, operationInputs)

  implicit val schema: Schema[EndpointTest] = struct(
    string.optional[EndpointTest]("documentation", _.documentation).addHints(smithy.api.Documentation("Documentation describing the test case.")),
    document.optional[EndpointTest]("params", _.params).addHints(smithy.api.Documentation("Defines rule-set parameters and values to use for testing rules-engine.")),
    OperationInputs.underlyingSchema.optional[EndpointTest]("operationInputs", _.operationInputs).addHints(smithy.api.Documentation("Defines a set of service operation configurations used for testing the rules-engine.")),
    EndpointTestExpectation.schema.required[EndpointTest]("expect", _.expect).addHints(smithy.api.Documentation("The expected outcome of the test case.")),
  )(make).withId(id).addHints(hints)
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy