ObjectType

class aws_cdk.aws_appsync.ObjectType(name, *, interface_types=None, definition, directives=None)

Bases: InterfaceType

(experimental) Object Types are types declared by you.

Stability:

experimental

ExampleMetadata:

infused

Example:

# api: appsync.GraphqlApi
# dummy_request: appsync.MappingTemplate
# dummy_response: appsync.MappingTemplate

info = appsync.ObjectType("Info",
    definition={
        "node": appsync.ResolvableField(
            return_type=appsync.GraphqlType.string(),
            args={
                "id": appsync.GraphqlType.string()
            },
            data_source=api.add_none_data_source("none"),
            request_mapping_template=dummy_request,
            response_mapping_template=dummy_response
        )
    }
)
Parameters:
  • name (str) –

  • interface_types (Optional[Sequence[InterfaceType]]) – (experimental) The Interface Types this Object Type implements. Default: - no interface types

  • definition (Mapping[str, IField]) – (experimental) the attributes of this type.

  • directives (Optional[Sequence[Directive]]) – (experimental) the directives for this object type. Default: - no directives

Stability:

experimental

Methods

add_field(*, field=None, field_name=None)

(experimental) Add a field to this Object Type.

Object Types must have both fieldName and field options.

Parameters:
  • field (Optional[IField]) – (experimental) The resolvable field to add. This option must be configured for Object, Interface, Input and Union Types. Default: - no IField

  • field_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 Intermediate Type.

Parameters:
  • is_list (Optional[bool]) – (experimental) property determining if this attribute is a list i.e. if true, attribute would be [Type]. Default: - false

  • is_required (Optional[bool]) – (experimental) property determining if this attribute is non-nullable i.e. if true, attribute would be Type! Default: - false

  • is_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:

GraphqlType

to_string()

(experimental) Generate the string of this object type.

Stability:

experimental

Return type:

str

Attributes

definition

(experimental) the attributes of this type.

Stability:

experimental

directives

(experimental) the directives for this object type.

Default:
  • no directives

Stability:

experimental

interface_types

(experimental) The Interface Types this Object Type implements.

Default:
  • no interface types

Stability:

experimental

name

(experimental) the name of this type.

Stability:

experimental

resolvers

(experimental) The resolvers linked to this data source.

Stability:

experimental