alloy.package.scala Maven / Gradle / Ivy
package object alloy {
/** A trait for specifying what example data looks like. Differs from the `smithy.api#examples` trait in that
* it can be used for any shape, not just operations. Below is an explanation of the different example formats
* that are supported.
* 1. SMITHY - this means that the examples will be using the `Document` abstraction and will be specified in
* a protocol agnostic way
* 2. JSON - this means the examples will use the `Document` abstraction, but will not be validated by the smithy
* `NodeValidationVisitor` like the first type are. This type can be used to specify protocol specific examples
* 3. STRING - this is just a string example and anything can be provided inside of the string.
* This can be helpful for showing e.g. xml or another encoding that isn't JSON and therefore doesn't fit nicely
* with `Node` semantics
*/
type DataExamples = alloy.DataExamples.Type
/** Use this trait to give a default value to a structure member. This
* is not the same as smithy.api#default which is more constrained.
* You can use `defaultValue` to specify a default that does not align
* with the target's shape constraints, where as Smithy's `default` trait
* prevents that. For example:
*
* ```smithy
* {@literal @}length(min:5)
* string MyString
* structure MyStruct {
* {@literal @}defaultValue("N/A") // that's valid
* s1: MyString
* s2: MyString = "N/A" // that's invalid
* }
* ```
*/
type DefaultValue = alloy.DefaultValue.Type
/** Discriminated unions contain the information about which
* branch of a union is encoded inside of the object itself.
* The following union:
* structure One {
* a: Int
* }
* structure Two {
* b: String
* }
* union Test {
* one: One
* two: Two
* }
* would normally be encoded in JSON as:
* { "one": { "a": 123 } }
* when annotated with `{@literal @}discriminated("type")`, it will
* instead be encoded as:
* { "a": 123, "type": "one" }
* This is more efficient than using an untagged encoding,
* but less efficient than using the default tagged union
* encoding. Therefore, it should only be used when necessary.
* Tagged union encodings should be used wherever possible.
*/
type Discriminated = alloy.Discriminated.Type
/** A version of {@literal @}examples that is not tied to a validator */
type UncheckedExamples = alloy.UncheckedExamples.Type
/** Changes the serialized key of a structure, union, or member. */
type UrlFormName = alloy.UrlFormName.Type
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy