Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[appsync]: support directives #9879

Closed
1 of 2 tasks
BryanPan342 opened this issue Aug 20, 2020 · 0 comments · Fixed by #9973
Closed
1 of 2 tasks

[appsync]: support directives #9879

BryanPan342 opened this issue Aug 20, 2020 · 0 comments · Fixed by #9973
Assignees
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2

Comments

@BryanPan342
Copy link
Contributor

BryanPan342 commented Aug 20, 2020

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

@BryanPan342 BryanPan342 added feature-request A feature should be added or improved. effort/medium Medium work item – several days of effort needs-triage This issue or PR still needs to be triaged. labels Aug 20, 2020
@BryanPan342 BryanPan342 self-assigned this Aug 20, 2020
@github-actions github-actions bot added the @aws-cdk/aws-appsync Related to AWS AppSync label Aug 20, 2020
@BryanPan342 BryanPan342 added p2 and removed needs-triage This issue or PR still needs to be triaged. labels Aug 21, 2020
@BryanPan342 BryanPan342 added the in-progress This issue is being actively worked on. label Aug 25, 2020
@mergify mergify bot closed this as completed in #9973 Sep 3, 2020
mergify bot pushed a commit that referenced this issue Sep 3, 2020
CDK supports auth directives for appsync. CDK has a class `appsync.Directive` that has static functions like `.iam()`, `.apiKey()`, etc. to give a field or type specific auth permissions.

**BREAKING CHANGE**: remove `statement` property for directives, instead use `toString`
- **AppSync**:  removed `appsync.Directive.statement` property, use the `appsync.Directive.toString()` function instead

Fixes: #9879 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-appsync Related to AWS AppSync effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on. p2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants