UnionType
- class aws_cdk.aws_appsync.UnionType(name, *, definition)
Bases:
object
(experimental) Union Types are abstract types that are similar to Interface Types, but they cannot to specify any common fields between types.
Note that fields of a union type need to be object types. In other words, you can’t create a union type out of interfaces, other unions, or inputs.
- Stability:
experimental
- ExampleMetadata:
infused
Example:
# api: appsync.GraphqlApi string = appsync.GraphqlType.string() human = appsync.ObjectType("Human", definition={"name": string}) droid = appsync.ObjectType("Droid", definition={"name": string}) starship = appsync.ObjectType("Starship", definition={"name": string}) search = appsync.UnionType("Search", definition=[human, droid, starship] ) api.add_type(search)
- Parameters:
name (
str
) –definition (
Sequence
[IIntermediateType
]) – (experimental) the object types for this union type.
- Stability:
experimental
Methods
- add_field(*, field=None, field_name=None)
(experimental) Add a field to this Union Type.
Input Types must have field options and the IField must be an Object Type.
- Parameters:
field (
Optional
[IField
]) – (experimental) The resolvable field to add. This option must be configured for Object, Interface, Input and Union Types. Default: - no IFieldfield_name (
Optional
[str
]) – (experimental) The name of the field. This option must be configured for Object, Interface, Input and Enum Types. Default: - no fieldName
- Stability:
experimental
- Return type:
None
- attribute(*, is_list=None, is_required=None, is_required_list=None)
(experimental) Create a GraphQL Type representing this Union Type.
- Parameters:
is_list (
Optional
[bool
]) – (experimental) property determining if this attribute is a list i.e. if true, attribute would be [Type]. Default: - falseis_required (
Optional
[bool
]) – (experimental) property determining if this attribute is non-nullable i.e. if true, attribute would be Type! Default: - falseis_required_list (
Optional
[bool
]) – (experimental) property determining if this attribute is a non-nullable list i.e. if true, attribute would be [ Type ]! or if isRequired true, attribe would be [ Type! ]! Default: - false
- Stability:
experimental
- Return type:
- to_string()
(experimental) Generate the string of this Union type.
- Stability:
experimental
- Return type:
str
Attributes
- definition
(experimental) the attributes of this type.
- Stability:
experimental
- name
(experimental) the name of this type.
- Stability:
experimental