Skip to content

AWS directives #1659

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

Closed
nealyip opened this issue Jan 11, 2019 · 1 comment
Closed

AWS directives #1659

nealyip opened this issue Jan 11, 2019 · 1 comment
Labels

Comments

@nealyip
Copy link

nealyip commented Jan 11, 2019

https://docs.aws.amazon.com/appsync/latest/devguide/real-time-data.html

Is there any way to implement the @aws_subscribe?

For example,

import {
    GraphQLSchema,
    GraphQLObjectType,
    GraphQLString,
    printSchema,
    GraphQLFieldConfig
} from 'graphql';

export function handler() {

    const schema = new GraphQLSchema({
        query: new GraphQLObjectType({
            name: 'Query',
            fields: {
                hello: {
                    type: GraphQLString,
                    resolve() {
                        return 'world';
                    }
                }
            }
        }),
        subscription: new GraphQLObjectType({
            name: 'Subscription',
            fields: {
                subscription:<GraphQLFieldConfig<any, any>> {
                    type: GraphQLString,
                    resolve() {
                        return 'world';
                    }
                }
            }
        })
    });

    const x = printSchema(schema);

    console.log(x);
}

will output

type Query {
  hello: String
}

type Subscription {
  subscription: String
}

How can I make it like

type Query {
  hello: String
}

type Subscription {
  subscription: String
     @aws_subscribe(mutations: ["addPost"])
}

Thank you.

@IvanGoncharov
Copy link
Member

Is there any way to implement the @aws_subscribe?

@nealyip Currently there is no way to do this. Possible solutions are discussed in #1343

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants