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

Error while parsing Graphql schema #10

Closed
LakshmiMekala opened this issue Jun 27, 2019 · 6 comments

Comments

@LakshmiMekala
Copy link

commented Jun 27, 2019

Current behavior (how does the issue manifest):

Expected behavior:
Failed to create engine: error creating trigger instances - Error while parsing Graphql schema: Syntax Error GraphQL (1:2) Expected Name, found String "Query"
Minimal steps to reproduce the problem (not required if feature enhancement):
Create flogo app with below graphql schema :
"graphqlSchema": {
"Query": {
"Name": "Query",
"Fields": {
"address": {
"Type": "address",
"Args": {
"street": {
"Type": "graphql.String"
},
"number": {
"Type": "graphql.String"
}
}
}
}
}
}
Please tell us about your environment (Operating system, docker version, browser & web ui version, etc):

Flogo version (CLI & contrib/lib. If unknown, leave empty or state unknown): 0.X.X
flogo cli version v0.9.0-1-g1bc9a1b
Additional information you deem important (e.g. issue happens only occasionally):

@vijaynalawade

This comment has been minimized.

Copy link
Contributor

commented Jul 3, 2019

@LakshmiMekala This is not correct GraphQL schema. It must adhere to specification.
Take a look at https://github.com/marmelab/GraphQL-example/blob/master/schema.graphql

@LakshmiMekala

This comment has been minimized.

Copy link
Author

commented Jul 4, 2019

@vijaynalawade It would be of great help if you can update the example json.

@LakshmiMekala

This comment has been minimized.

Copy link
Author

commented Jul 5, 2019

@vijaynalawade We tried passing content in 2 ways to graphql schema

  1. Content of https://github.com/marmelab/GraphQL-example/blob/master/schema.graphql to graphql schema as string
  2. Passing schema file to graphql schema as string .

For both the ways observed **Failed to create engine: error creating trigger instances - Error while parsing Graphql schema: Syntax Error **

@cpramodroy

This comment has been minimized.

Copy link
Collaborator

commented Jul 5, 2019

@LakshmiMekala I updated the readme and sample applications #11. Can you please try again?
The schema which @vijaynalawade pointed to, will not work because it has "scalar" elements which are currently not supported in the current version of the graphql trigger. I will update the readme with all the limitations.

@LakshmiMekala

This comment has been minimized.

Copy link
Author

commented Jul 9, 2019

@cpramodroy can you update readme for example2.json..,
when i run mutation request: {"mutation":"mutation{ CreatePost(postObj:{title: "abc",body: "test123"}){ user{ name: "Sam" , userId: 1 } }}"}
response : {
"data": null,
"errors": [
{
"message": "Must provide an operation.",
"locations": []
}
]
}

@cpramodroy

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

@LakshmiMekala I am running my mutation requests from Postman. The mutation requests can be sent either as POST request or as a GET request.

As a POST request:

The POST request has two parts:

  1. Pre-request script
    image

  2. Body
    image

Output for above request:
image

As a GET Request:

Url: http://localhost:7879/graphql?query=mutation CreatePostMutation($post: PostInput) { CreatePost(post: $post) { postId title body}}&variables={"post": {"userId": 5, "title": "Sample Title", "body": "A quick white fox jumped over the lazy brown dog"}}

Output for above request:
image

For Get requests, we can also use www.graphqlbin.com that takes in a graphql server url (in our case http://localhost:7879/graphql) and provides a graphiql interface to execute queries. See example below:
image

@cpramodroy cpramodroy closed this Jul 17, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.