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
@@ -177,19 +177,22 @@ type __InputObjectQueryInput struct {
|
||||
// GetQuery returns __InputObjectQueryInput.Query, and is useful for accessing the field via an interface.
|
||||
func (v *__InputObjectQueryInput) GetQuery() UserQueryInput { return v.Query }
|
||||
|
||||
// The query or mutation executed by InputObjectQuery.
|
||||
const InputObjectQueryOperation = `
|
||||
query InputObjectQuery ($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
func InputObjectQuery(
|
||||
client graphql.Client,
|
||||
query UserQueryInput,
|
||||
) (*InputObjectQueryResponse, error) {
|
||||
req := &graphql.Request{
|
||||
OpName: "InputObjectQuery",
|
||||
Query: `
|
||||
query InputObjectQuery ($query: UserQueryInput) {
|
||||
user(query: $query) {
|
||||
id
|
||||
}
|
||||
}
|
||||
`,
|
||||
Query: InputObjectQueryOperation,
|
||||
Variables: &__InputObjectQueryInput{
|
||||
Query: query,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user