class SchemaFile
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AppSync.SchemaFile |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsappsync#SchemaFile |
Java | software.amazon.awscdk.services.appsync.SchemaFile |
Python | aws_cdk.aws_appsync.SchemaFile |
TypeScript (source) | aws-cdk-lib » aws_appsync » SchemaFile |
Implements
ISchema
The Schema for a GraphQL Api.
If no options are configured, schema will be generated code-first.
Example
const schema = new appsync.SchemaFile({ filePath: 'mySchemaFile' })
new appsync.GraphqlApi(this, 'api', {
name: 'myApi',
definition: appsync.Definition.fromSchema(schema),
enhancedMetricsConfig: {
dataSourceLevelMetricsBehavior: appsync.DataSourceLevelMetricsBehavior.FULL_REQUEST_DATA_SOURCE_METRICS,
operationLevelMetricsConfig: appsync.OperationLevelMetricsConfig.ENABLED,
resolverLevelMetricsBehavior: appsync.ResolverLevelMetricsBehavior.FULL_REQUEST_RESOLVER_METRICS,
},
});
Initializer
new SchemaFile(options: SchemaProps)
Parameters
- options
SchemaProps
Properties
| Name | Type | Description |
|---|---|---|
| definition | string | The definition for this schema. |
definition
Type:
string
The definition for this schema.
Methods
| Name | Description |
|---|---|
| bind(api, _options?) | Called when the GraphQL Api is initialized to allow this object to bind to the stack. |
| static from | Generate a Schema from file. |
bind(api, _options?)
public bind(api: IGraphQLApiRef, _options?: SchemaBindOptions): ISchemaConfig
Parameters
- api
IGraph— The binding GraphQL Api.QLApi Ref - _options
SchemaBind Options
Returns
Called when the GraphQL Api is initialized to allow this object to bind to the stack.
static fromAsset(filePath)
public static fromAsset(filePath: string): SchemaFile
Parameters
- filePath
string— the file path of the schema file.
Returns
Generate a Schema from file.

.NET
Go
Java
Python
TypeScript (