alloy

package alloy

Members list

Packages

package alloy.common

Type members

Classlikes

sealed trait DataExample extends Product, Serializable

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
Known subtypes
class JsonCase
class SmithyCase
class StringCase
Self type

Attributes

Companion
trait
Supertypes
trait Sum
trait Mirror
trait Has[DataExample]
trait HasId
class Object
trait Matchable
class Any
Show all
Self type

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.

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

Attributes

Supertypes
trait HasId
class Object
trait Matchable
class Any
Self type
final case class DateFormat()

This trait indicates that a String value contains a date without a time component. Following the RFC-3339 (an extension of ISO 8601), the default for a date is the following: date-fullyear = 4DIGIT date-month = 2DIGIT ; 01-12 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on ; month/year full-date = date-fullyear "-" date-month "-" date-mday

This trait indicates that a String value contains a date without a time component. Following the RFC-3339 (an extension of ISO 8601), the default for a date is the following: date-fullyear = 4DIGIT date-month = 2DIGIT ; 01-12 date-mday = 2DIGIT ; 01-28, 01-29, 01-30, 01-31 based on ; month/year full-date = date-fullyear "-" date-month "-" date-mday

See: https://www.rfc-editor.org/rfc/rfc3339#section-5.6 e.g.: "2022-03-30" If a time component is required, you can use smithy.api#Timestamp

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object DateFormat extends Companion[DateFormat]

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait Has[DateFormat]
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
DateFormat.type
object DefaultValue extends Newtype[Document]

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:

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:

`@`length(min:5)
string MyString
structure MyStruct {
 `@`defaultValue("N/A") // that's valid
 s1: MyString
 s2: MyString = "N/A" // that's invalid
}

Attributes

Supertypes
class Newtype[Document]
trait HasId
class Object
trait Matchable
class Any
Self type
object Discriminated extends Newtype[String]

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 ``@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.

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 ``@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.

Attributes

Supertypes
class Newtype[String]
trait HasId
class Object
trait Matchable
class Any
Self type
final case class Nullable()

Use this trait to mark some field as nullable. This is to make a distinction between an optional field that is missing and one that's explicitly set to null.

Use this trait to mark some field as nullable. This is to make a distinction between an optional field that is missing and one that's explicitly set to null.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Nullable extends Companion[Nullable]

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait Has[Nullable]
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
Nullable.type
final case class OpenEnum()

Specifies that an enumeration is open meaning that it can accept "unknown" values that are not explicitly specified inside of the smithy enum shape definition.

Specifies that an enumeration is open meaning that it can accept "unknown" values that are not explicitly specified inside of the smithy enum shape definition.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object OpenEnum extends Companion[OpenEnum]

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait Has[OpenEnum]
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
OpenEnum.type
final case class SimpleRestJson()

A rest protocol that deals with JSON payloads only in HTTP requests and responses. These are encoded with the content type application/json. See Alloy documentation for more information.

A rest protocol that deals with JSON payloads only in HTTP requests and responses. These are encoded with the content type application/json. See Alloy documentation for more information.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
final case class StructurePattern(pattern: String, target: ShapeId)

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
final case class UncheckedExample(title: String, documentation: Option[String], input: Option[Document], output: Option[Document])

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
Show all
Self type

A version of @examples that is not tied to a validator

A version of @examples that is not tied to a validator

Attributes

Supertypes
trait HasId
class Object
trait Matchable
class Any
Self type
final case class Untagged()

Implies a different encoding for unions where different alternatives are not tagged. This union type should be avoided whenever possible for performance reasons. However, some third party APIs use it so it is important to be able to represent it. 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 it is annotated with ``@untagged, it is instead encoded as: { "a": 123 }. Therefore the parser will need to try each different alternative in the union before it can determine which one is appropriate.

Implies a different encoding for unions where different alternatives are not tagged. This union type should be avoided whenever possible for performance reasons. However, some third party APIs use it so it is important to be able to represent it. 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 it is annotated with ``@untagged, it is instead encoded as: { "a": 123 }. Therefore the parser will need to try each different alternative in the union before it can determine which one is appropriate.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object Untagged extends Companion[Untagged]

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait Has[Untagged]
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
Untagged.type
final case class UrlFormFlattened()

Unwraps the values of a list, set, or map into the containing structure/union.

Unwraps the values of a list, set, or map into the containing structure/union.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
object UrlFormName extends Newtype[String]

Changes the serialized key of a structure, union, or member.

Changes the serialized key of a structure, union, or member.

Attributes

Supertypes
class Newtype[String]
trait HasId
class Object
trait Matchable
class Any
Self type
final case class UuidFormat()

UUID v4 compliant with RFC 4122

UUID v4 compliant with RFC 4122

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object UuidFormat extends Companion[UuidFormat]

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
trait Has[UuidFormat]
trait HasId
class Object
trait Matchable
class Any
Show all
Self type
UuidFormat.type

Types

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.

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

Attributes

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:

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:

`@`length(min:5)
string MyString
structure MyStruct {
 `@`defaultValue("N/A") // that's valid
 s1: MyString
 s2: MyString = "N/A" // that's invalid
}

Attributes

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 ``@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.

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 ``@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.

Attributes

A version of @examples that is not tied to a validator

A version of @examples that is not tied to a validator

Attributes

type UrlFormName = Type

Changes the serialized key of a structure, union, or member.

Changes the serialized key of a structure, union, or member.

Attributes