smithy4s.smithy.rules.EndpointTests.scala Maven / Gradle / Ivy
package smithy.rules
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.recursive
import smithy4s.schema.Schema.string
import smithy4s.schema.Schema.struct
/** Defines endpoint test-cases for validating a client's endpoint rule-set.
* @param version
* The endpoint tests schema version.
* @param testCases
* List of endpoint test cases.
*/
final case class EndpointTests(version: String, testCases: Option[List[EndpointTest]] = None)
object EndpointTests extends ShapeTag.Companion[EndpointTests] {
val id: ShapeId = ShapeId("smithy.rules", "endpointTests")
val hints: Hints = Hints(
smithy.api.Documentation("Defines endpoint test-cases for validating a client\'s endpoint rule-set."),
smithy.api.Unstable(),
smithy.api.Trait(selector = Some("service"), structurallyExclusive = None, conflicts = None, breakingChanges = None),
).lazily
// constructor using the original order from the spec
private def make(version: String, testCases: Option[List[EndpointTest]]): EndpointTests = EndpointTests(version, testCases)
implicit val schema: Schema[EndpointTests] = recursive(struct(
string.required[EndpointTests]("version", _.version).addHints(smithy.api.Documentation("The endpoint tests schema version.")),
EndpointTestList.underlyingSchema.optional[EndpointTests]("testCases", _.testCases).addHints(smithy.api.Documentation("List of endpoint test cases.")),
)(make).withId(id).addHints(hints))
}