Skip to content

[appsync]: support directives #9879

@BryanPan342

Description

@BryanPan342

Supporting directives for types and fields:

  • basic directives: @include, @deprecated, @skip
  • appsync auth directives: @iam, @api_key, etc.

Use Case

Directives are a core feature of graphql.

Proposed Solution

/**
 * Directives for types
 *
 * i.e. @aws_iam or @aws_subscribe
 */
export class Directive {
  /**
   * Add the @aws_iam directive
   */
  public static iam(): Directive{
    return new Directive('@aws_iam');
  }

...

  /**
   * Add a custom directive
   *
   * @param statement - the directive statement to append
   */
  public static custom(statement: string): Directive {
    return new Directive(statement);
  }

  /**
   * the directive statement
   */
  public readonly statement: string;

  private constructor(statement: string) { this.statement = statement; }
}

Directives can be attached to fields or types.

Other

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Labels

@aws-cdk/aws-appsyncRelated to AWS AppSynceffort/mediumMedium work item – several days of effortfeature-requestA feature should be added or improved.in-progressThis issue is being actively worked on.p2

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions