Commit Graph
21 Commits
Author SHA1 Message Date
Ben KraftandGitHub d4ec64fef1 Simplify errors tests a bit so they don't all have to write a schema (#196)
Some of the errors tests need to have their own schema, so the schema
can do something weird (or even be entirely invalid!).  But most can
still share a schema.  In this commit I have those indeed share a
schema, to avoid having to have a bunch of copies of mostly the same
schema.  While doing so I noticed one error whose location wasn't very
useful, and fixed it.

Test plan: make check
2022-05-15 12:20:18 -07:00
Ben KraftandGitHub 39cd158d33 Reject operation or argument names that are Go keywords (#195)
GraphQL is pretty restrictive about its identifiers, so for the most
part we can and do safely use GraphQL identifiers in the Go we generate
with attention only to conflicts with other such identifiers. But we do
need to check one thing, which is that the identifier isn't a Go
keyword. (If it is, the generated code will almost certainly fail to
compile, but often with a confusing error message.) In this commit I add
such checks.

The most likely place to run into trouble here is argument names, which
are often one word and are used as-is.  Operation names, if unexported,
can also be keywords, although in practice they're usually multiword.
Field names are always exported, thus safe.  Generated type names are
always prefixed, camel-cased, with the operation name, so they always
contain an uppercase letter (even if the operation name is lowercase),
but type-names specified by `typename` may collide, so we check those.
In theory we could check type-names specified by `bind`, but these must
be defined by the user, so their code will already fail to compile, so I
didn't bother.  I think that's all the places to consider, although it's
hard to be sure.  In summary, we check argument names, operation names,
and user-specified type names.

Test plan: make check
2022-05-12 15:00:55 -07:00
Ben KraftandGitHub c8cbe805eb Add mention of tools.go to FAQ (#189)
This came up in #160, and will surely come up again. I hope the Go
folks figure out something better here, but until such time...
2022-04-29 13:26:32 -07:00
Ben KraftandGitHub 33f4d9642e issue templates 2021-04-06 14:06:38 -07:00
Ben Kraft 53a94dfb4f add makefile 2020-01-17 18:24:18 -05:00
Ben Kraft c19f62c2c7 non-ridiculous handling of scalars 2020-01-17 18:23:29 -05:00
Ben Kraft bc2cd1a12f TODOs 2020-01-16 18:20:36 -08:00
Ben Kraft 6f56e25cc8 rewording in README 2020-01-16 18:19:17 -08:00
Ben Kraft f779b5eb58 more rearranging README 2020-01-16 18:17:40 -08:00
Ben Kraft 541e7e3357 messing with formatting in README 2020-01-16 18:15:36 -08:00
Ben Kraft 06510c2a67 more complete example in the README 2020-01-16 18:09:55 -08:00
Ben Kraft 4571dc72af add license 2020-01-16 18:03:07 -08:00
Ben Kraft 35699a73ef more README stuff, example README, other misc cleanup 2020-01-16 17:56:13 -08:00
Ben Kraft 7f6ab70ee3 wire auth to example, fix wire format, it's aliiiiiive! 2019-12-25 21:33:12 -05:00
Ben Kraft 4d880a701e move a bunch of the logic from generated into client 2019-12-25 16:26:32 -05:00
Ben Kraft 9d4b5559f4 wire up example by way of testing 2019-12-24 16:05:10 -05:00
Ben Kraft 9a157470b3 replace handwritten generated code with actual generated code 2019-12-24 15:56:01 -05:00
Ben Kraft 4a2134c533 add some TODOs 2019-12-23 23:26:51 -05:00
Ben Kraft e8b5ccbcda generates something mostly plausiblegit add . 2019-12-23 23:22:19 -05:00
Ben Kraft 7a20e2ae74 fill out the easy parts of the codegen 2019-12-23 21:07:07 -05:00
Ben Kraft efa9ccd122 add basic query struct, support 1.12 2019-12-23 19:35:38 -05:00