alloy

package alloy

Members list

Concise view

Type members

Classlikes

sealed trait DataExample extends Product with Serializable

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Known subtypes

Attributes

Companion:
trait
Graph
Supertypes
trait Sum
trait Mirror
trait HasId
class Object
trait Matchable
class Any
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

Graph
Supertypes
trait HasId
class Object
trait Matchable
class Any
Self type
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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
Self 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

Graph
Supertypes
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

Graph
Supertypes
trait HasId
class Object
trait Matchable
class Any
Self type
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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
object Nullable extends Companion[Nullable]

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
trait Has[Nullable]
trait HasId
class Object
trait Matchable
class Any
Self type
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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

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

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

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

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
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

Graph
Supertypes
trait HasId
class Object
trait Matchable
class Any
Self type
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
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
object Untagged extends Companion[Untagged]

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
trait Has[Untagged]
trait HasId
class Object
trait Matchable
class Any
Self type
case class UuidFormat()

UUID v4 compliant with RFC 4122

UUID v4 compliant with RFC 4122

Attributes

Companion:
object
Graph
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any

Attributes

Companion:
class
Graph
Supertypes
trait Product
trait Mirror
trait HasId
class Object
trait Matchable
class Any
Self 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