Expose the graphql operation as a constant in the generated genqlient file (#238)
This allows client code to see the operation (query or mutation) exactly
as genqlient sends it over the wire. This data was already available in
the generated safelist.json file, but now it's easily available from Go
code as well.
Fixes #236
I have:
- [x] Written a clear PR title and description (above)
- [x] Signed the [Khan Academy CLA](https://www.khanacademy.org/r/cla)
- [x] Added tests covering my changes, if applicable
- [x] Included a link to the issue fixed, if applicable
- [x] Included documentation, for new features
- [x] Added an entry to the changelog
This commit is contained in:
+10
-7
@@ -62,12 +62,8 @@ const (
|
||||
RoleTeacher Role = "TEACHER"
|
||||
)
|
||||
|
||||
func QueryWithEnums(
|
||||
client graphql.Client,
|
||||
) (*QueryWithEnumsResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "QueryWithEnums",
|
||||
Query: `
|
||||
// The query or mutation executed by QueryWithEnums.
|
||||
const QueryWithEnumsOperation = `
|
||||
query QueryWithEnums {
|
||||
user {
|
||||
roles
|
||||
@@ -76,7 +72,14 @@ query QueryWithEnums {
|
||||
roles
|
||||
}
|
||||
}
|
||||
`,
|
||||
`
|
||||
|
||||
func QueryWithEnums(
|
||||
client graphql.Client,
|
||||
) (*QueryWithEnumsResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "QueryWithEnums",
|
||||
Query: QueryWithEnumsOperation,
|
||||
}
|
||||
var err error
|
||||
|
||||
|
||||
Reference in New Issue
Block a user