GraphQL? #147
Replies: 8 comments
-
Hi, not at all. Only regular http requests and assertions for http header and json body are available currently, plus websocket support. |
Beta Was this translation helpful? Give feedback.
-
Do you think there might be in the future? |
Beta Was this translation helpful? Give feedback.
-
Personally I don't have any plans on that. However probably this would be an eligible feature. I guess we could implement an alternative request builder for graphql and reuse existing payload matches. |
Beta Was this translation helpful? Give feedback.
-
@gavv May i pick this up ? I'll start with submitting a short design proposal on the request builder. |
Beta Was this translation helpful? Give feedback.
-
@gtourkas Sure, you're welcome! |
Beta Was this translation helpful? Give feedback.
-
@gavv I've looked into this a bit. We could use https://github.com/shurcooL/graphql, that will provide with the means of typed graphql queries and mutations in the form of go structs. An example of a query with constant arguments: var q struct {
Human struct {
Name graphql.String
Height graphql.Float `graphql:"height(unit: METER)"`
} `graphql:"human(id: \"1000\")"`
} In addition, we could provide with a var q struct {
Human struct {
Name graphql.String
Height graphql.Float `graphql:"height(unit: $unit)"`
} `graphql:"human(id: $id)"`
} and the respective values: variables := map[string]interface{}{
"id": graphql.ID(id),
"unit": starwars.LengthUnit("METER"),
} I don't see any need for additions in the assessment part, as the GraphQL queries return JSON. Overall it looks like a low-hanging fruit and I can have something ready in my fork in a few days. Please let me know if the above make sense to you. UPDATE: The shurcool lib has been forked by Hasura (https://github.com/hasura/go-graphql-client), which added support for named operations. Looks like a better candidate imo. |
Beta Was this translation helpful? Give feedback.
-
@gavv Did you have the chance to look into my suggestion above ? |
Beta Was this translation helpful? Give feedback.
-
@gtourkas Seems your message lost in my mail :[ Found it now, when I was migrating some issue to discussion. Yes,the suggestion looks very good. |
Beta Was this translation helpful? Give feedback.
-
Is there a comfortable way to test GraphQL endpoints?
Beta Was this translation helpful? Give feedback.
All reactions