java.lang.Object
software.amazon.jsii.JsiiObject
software.amazon.awscdk.services.appsync.Schema
All Implemented Interfaces:
software.amazon.jsii.JsiiSerializable

@Generated(value="jsii-pacmak/1.84.0 (build 5404dcf)", date="2023-06-19T16:30:49.574Z") @Stability(Experimental) public class Schema extends software.amazon.jsii.JsiiObject
(experimental) The Schema for a GraphQL Api.

If no options are configured, schema will be generated code-first.

Example:

 GraphqlApi api = GraphqlApi.Builder.create(this, "api")
         .name("api")
         .schema(Schema.fromAsset(join(__dirname, "schema.graphql")))
         .build();
 HttpDataSource httpDs = api.addHttpDataSource("ds", "https://states.amazonaws.com", HttpDataSourceOptions.builder()
         .name("httpDsWithStepF")
         .description("from appsync to StepFunctions Workflow")
         .authorizationConfig(AwsIamConfig.builder()
                 .signingRegion("us-east-1")
                 .signingServiceName("states")
                 .build())
         .build());
 httpDs.createResolver(BaseResolverProps.builder()
         .typeName("Mutation")
         .fieldName("callStepFunction")
         .requestMappingTemplate(MappingTemplate.fromFile("request.vtl"))
         .responseMappingTemplate(MappingTemplate.fromFile("response.vtl"))
         .build());
 
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static final class 
    (experimental) A fluent builder for Schema.

    Nested classes/interfaces inherited from class software.amazon.jsii.JsiiObject

    software.amazon.jsii.JsiiObject.InitializationMode
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
     
     
     
    protected
    Schema(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
     
    protected
    Schema(software.amazon.jsii.JsiiObjectRef objRef)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    addMutation(String fieldName, ResolvableField field)
    (experimental) Add a mutation field to the schema's Mutation.
    addQuery(String fieldName, ResolvableField field)
    (experimental) Add a query field to the schema's Query.
    addSubscription(String fieldName, Field field)
    (experimental) Add a subscription field to the schema's Subscription.
    void
    addToSchema(String addition)
    (experimental) Escape hatch to add to Schema as desired.
    void
    addToSchema(String addition, String delimiter)
    (experimental) Escape hatch to add to Schema as desired.
    (experimental) Add type to the schema.
    (experimental) Called when the GraphQL Api is initialized to allow this object to bind to the stack.
    static Schema
    fromAsset(String filePath)
    (experimental) Generate a Schema from file.
    (experimental) The definition for this schema.
    void
    (experimental) The definition for this schema.

    Methods inherited from class software.amazon.jsii.JsiiObject

    jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSet

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface software.amazon.jsii.JsiiSerializable

    $jsii$toJson
  • Constructor Details

    • Schema

      protected Schema(software.amazon.jsii.JsiiObjectRef objRef)
    • Schema

      protected Schema(software.amazon.jsii.JsiiObject.InitializationMode initializationMode)
    • Schema

      @Stability(Experimental) public Schema(@Nullable SchemaOptions options)
      Parameters:
      options -
    • Schema

      @Stability(Experimental) public Schema()
  • Method Details

    • fromAsset

      @Stability(Experimental) @NotNull public static Schema fromAsset(@NotNull String filePath)
      (experimental) Generate a Schema from file.

      Parameters:
      filePath - the file path of the schema file. This parameter is required.
      Returns:
      SchemaAsset with immutable schema defintion
    • addMutation

      @Stability(Experimental) @NotNull public ObjectType addMutation(@NotNull String fieldName, @NotNull ResolvableField 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:
      fieldName - the name of the Mutation. This parameter is required.
      field - the resolvable field to for this Mutation. This parameter is required.
    • addQuery

      @Stability(Experimental) @NotNull public ObjectType addQuery(@NotNull String fieldName, @NotNull ResolvableField 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:
      fieldName - the name of the query. This parameter is required.
      field - the resolvable field to for this query. This parameter is required.
    • addSubscription

      @Stability(Experimental) @NotNull public ObjectType addSubscription(@NotNull String fieldName, @NotNull Field 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:
      fieldName - the name of the Subscription. This parameter is required.
      field - the resolvable field to for this Subscription. This parameter is required.
    • addToSchema

      @Stability(Experimental) public void addToSchema(@NotNull String addition, @Nullable String delimiter)
      (experimental) Escape hatch to add to Schema as desired.

      Will always result in a newline.

      Default: - ''

      Parameters:
      addition - the addition to add to schema. This parameter is required.
      delimiter - the delimiter between schema and addition.
    • addToSchema

      @Stability(Experimental) public void addToSchema(@NotNull String addition)
      (experimental) Escape hatch to add to Schema as desired.

      Will always result in a newline.

      Default: - ''

      Parameters:
      addition - the addition to add to schema. This parameter is required.
    • addType

      @Stability(Experimental) @NotNull public IIntermediateType addType(@NotNull IIntermediateType type)
      (experimental) Add type to the schema.

      Parameters:
      type - the intermediate type to add to the schema. This parameter is required.
    • bind

      @Stability(Experimental) @NotNull public CfnGraphQLSchema bind(@NotNull GraphqlApi api)
      (experimental) Called when the GraphQL Api is initialized to allow this object to bind to the stack.

      Parameters:
      api - The binding GraphQL Api. This parameter is required.
    • getDefinition

      @Stability(Experimental) @NotNull public String getDefinition()
      (experimental) The definition for this schema.
    • setDefinition

      @Stability(Experimental) public void setDefinition(@NotNull String value)
      (experimental) The definition for this schema.