Class Schema
(experimental) The Schema for a GraphQL Api.
Inheritance
Namespace: Amazon.CDK.AWS.AppSync
Assembly: Amazon.CDK.AWS.AppSync.dll
Syntax (csharp)
public class Schema : DeputyBase
Syntax (vb)
Public Class Schema
Inherits DeputyBase
Remarks
If no options are configured, schema will be generated code-first.
Stability: Experimental
ExampleMetadata: infused
Examples
var api = new GraphqlApi(this, "api", new GraphqlApiProps {
Name = "api",
Schema = Schema.FromAsset(Join(__dirname, "schema.graphql"))
});
var httpDs = api.AddHttpDataSource("ds", "https://states.amazonaws.com", new HttpDataSourceOptions {
Name = "httpDsWithStepF",
Description = "from appsync to StepFunctions Workflow",
AuthorizationConfig = new AwsIamConfig {
SigningRegion = "us-east-1",
SigningServiceName = "states"
}
});
httpDs.CreateResolver(new BaseResolverProps {
TypeName = "Mutation",
FieldName = "callStepFunction",
RequestMappingTemplate = MappingTemplate.FromFile("request.vtl"),
ResponseMappingTemplate = MappingTemplate.FromFile("response.vtl")
});
Synopsis
Constructors
Schema(ISchemaOptions) | |
Schema(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
Schema(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
Properties
Definition | (experimental) The definition for this schema. |
Methods
AddMutation(String, ResolvableField) | (experimental) Add a mutation field to the schema's Mutation. CDK will create an Object Type called 'Mutation'. For example,. |
AddQuery(String, ResolvableField) | (experimental) Add a query field to the schema's Query. CDK will create an Object Type called 'Query'. For example,. |
AddSubscription(String, Field) | (experimental) Add a subscription field to the schema's Subscription. CDK will create an Object Type called 'Subscription'. For example,. |
AddToSchema(String, String) | (experimental) Escape hatch to add to Schema as desired. |
AddType(IIntermediateType) | (experimental) Add type to the schema. |
Bind(GraphqlApi) | (experimental) Called when the GraphQL Api is initialized to allow this object to bind to the stack. |
FromAsset(String) | (experimental) Generate a Schema from file. |
Constructors
Schema(ISchemaOptions)
public Schema(ISchemaOptions options = null)
Parameters
- options ISchemaOptions
Remarks
Stability: Experimental
Schema(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected Schema(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
Schema(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected Schema(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
Properties
Definition
(experimental) The definition for this schema.
public virtual string Definition { get; set; }
Property Value
System.String
Remarks
Stability: Experimental
Methods
AddMutation(String, ResolvableField)
(experimental) Add a mutation field to the schema's Mutation. CDK will create an Object Type called 'Mutation'. For example,.
public virtual ObjectType AddMutation(string fieldName, ResolvableField field)
Parameters
- fieldName System.String
the name of the Mutation.
- field ResolvableField
the resolvable field to for this Mutation.
Returns
Remarks
type Mutation { fieldName: Field.returnType }
Stability: Experimental
AddQuery(String, ResolvableField)
(experimental) Add a query field to the schema's Query. CDK will create an Object Type called 'Query'. For example,.
public virtual ObjectType AddQuery(string fieldName, ResolvableField field)
Parameters
- fieldName System.String
the name of the query.
- field ResolvableField
the resolvable field to for this query.
Returns
Remarks
type Query { fieldName: Field.returnType }
Stability: Experimental
AddSubscription(String, Field)
(experimental) Add a subscription field to the schema's Subscription. CDK will create an Object Type called 'Subscription'. For example,.
public virtual ObjectType AddSubscription(string fieldName, Field field)
Parameters
- fieldName System.String
the name of the Subscription.
- field Field
the resolvable field to for this Subscription.
Returns
Remarks
type Subscription { fieldName: Field.returnType }
Stability: Experimental
AddToSchema(String, String)
(experimental) Escape hatch to add to Schema as desired.
public virtual void AddToSchema(string addition, string delimiter = null)
Parameters
- addition System.String
the addition to add to schema.
- delimiter System.String
the delimiter between schema and addition.
Remarks
Will always result in a newline.
Default: - ''
Stability: Experimental
AddType(IIntermediateType)
(experimental) Add type to the schema.
public virtual IIntermediateType AddType(IIntermediateType type)
Parameters
- type IIntermediateType
the intermediate type to add to the schema.
Returns
Remarks
Stability: Experimental
Bind(GraphqlApi)
(experimental) Called when the GraphQL Api is initialized to allow this object to bind to the stack.
public virtual CfnGraphQLSchema Bind(GraphqlApi api)
Parameters
- api GraphqlApi
The binding GraphQL Api.
Returns
Remarks
Stability: Experimental
FromAsset(String)
(experimental) Generate a Schema from file.
public static Schema FromAsset(string filePath)
Parameters
- filePath System.String
the file path of the schema file.
Returns
SchemaAsset
with immutable schema defintion
Remarks
Stability: Experimental