alloy
Members list
Type members
Classlikes
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
Attributes
- Companion:
- class
- Graph
- Supertypes
- trait Producttrait Mirrortrait Companion[DateFormat]trait Has[DateFormat]trait ShapeTag[DateFormat]trait HasIdclass Objecttrait Matchableclass Any
- Self type
- DateFormat.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:
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
- Self type
- 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 @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
- Self type
- Discriminated.type
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.
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
Attributes
- Companion:
- class
- Graph
- Supertypes
- trait Producttrait Mirrortrait Companion[SimpleRestJson]trait Has[SimpleRestJson]trait ShapeTag[SimpleRestJson]trait HasIdclass Objecttrait Matchableclass Any
- Self type
- SimpleRestJson.type
Attributes
- Companion:
- class
- Graph
- Supertypes
- trait Producttrait Mirrortrait Companion[UncheckedExample]trait Has[UncheckedExample]trait ShapeTag[UncheckedExample]trait HasIdclass Objecttrait Matchableclass Any
- Self type
- UncheckedExample.type
Attributes
- Graph
- Supertypes
- Self type
- UncheckedExamples.type
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
Attributes
- Companion:
- class
- Graph
- Supertypes
- trait Producttrait Mirrortrait Companion[UuidFormat]trait Has[UuidFormat]trait ShapeTag[UuidFormat]trait HasIdclass Objecttrait Matchableclass Any
- Self type
- UuidFormat.type
Types
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.