Schema
- class aws_cdk.aws_appsync.Schema(*, file_path=None)
Bases:
object
(experimental) The Schema for a GraphQL Api.
If no options are configured, schema will be generated code-first.
- Stability:
experimental
- ExampleMetadata:
infused
Example:
api = appsync.GraphqlApi(self, "api", name="api", schema=appsync.Schema.from_asset(path.join(__dirname, "schema.graphql")) ) http_ds = api.add_http_data_source("ds", "https://states.amazonaws.com", name="httpDsWithStepF", description="from appsync to StepFunctions Workflow", authorization_config=appsync.AwsIamConfig( signing_region="us-east-1", signing_service_name="states" ) ) http_ds.create_resolver( type_name="Mutation", field_name="callStepFunction", request_mapping_template=appsync.MappingTemplate.from_file("request.vtl"), response_mapping_template=appsync.MappingTemplate.from_file("response.vtl") )
- Parameters:
file_path (
Optional
[str
]) – (experimental) The file path for the schema. When this option is configured, then the schema will be generated from an existing file from disk. Default: - schema not configured through disk asset- Stability:
experimental
Methods
- add_mutation(field_name, field)
(experimental) Add a mutation field to the schema’s Mutation. CDK will create an Object Type called ‘Mutation’. For example,.
type Mutation { fieldName: Field.returnType }
- Parameters:
field_name (
str
) – the name of the Mutation.field (
ResolvableField
) – the resolvable field to for this Mutation.
- Stability:
experimental
- Return type:
- add_query(field_name, field)
(experimental) Add a query field to the schema’s Query. CDK will create an Object Type called ‘Query’. For example,.
type Query { fieldName: Field.returnType }
- Parameters:
field_name (
str
) – the name of the query.field (
ResolvableField
) – the resolvable field to for this query.
- Stability:
experimental
- Return type:
- add_subscription(field_name, field)
(experimental) Add a subscription field to the schema’s Subscription. CDK will create an Object Type called ‘Subscription’. For example,.
type Subscription { fieldName: Field.returnType }
- Parameters:
field_name (
str
) – the name of the Subscription.field (
Field
) – the resolvable field to for this Subscription.
- Stability:
experimental
- Return type:
- add_to_schema(addition, delimiter=None)
(experimental) Escape hatch to add to Schema as desired.
Will always result in a newline.
- Parameters:
addition (
str
) – the addition to add to schema.delimiter (
Optional
[str
]) – the delimiter between schema and addition.
- Default:
‘’
- Stability:
experimental
- Return type:
None
- add_type(type)
(experimental) Add type to the schema.
- Parameters:
type (
IIntermediateType
) – the intermediate type to add to the schema.- Stability:
experimental
- Return type:
- bind(api)
(experimental) Called when the GraphQL Api is initialized to allow this object to bind to the stack.
- Parameters:
api (
GraphqlApi
) – The binding GraphQL Api.- Stability:
experimental
- Return type:
Attributes
- definition
(experimental) The definition for this schema.
- Stability:
experimental
Static Methods