Commit Graph

27 Commits

Author SHA1 Message Date
Ben Kraft 6c86eed770 Clean up, test, and document ContextType and ClientGetter options (#77)
## Summary:
ContextType is in use at Khan as a part of our ka-context system; it
basically just lets you configure the type to pass as the `ctx` argument
to genqlient helpers (or say to omit such an argument).  ClientGetter I
wrote thinking we might use it; then we didn't (because we have a few
different clients we may use) but it's not much code and may be helpful
to others.  In this commit I clean up, document, and add tests for both
options.

The cleanup is mainly for ClientGetter, which was kind of broken before
because it was a Go snippet but couldn't specify imports.  I was
thinking maybe you want to be able to write `ctx.Something()`, but I
just don't see how to make it work, so I made it a function of context,
which is probably the better idea anyway.

Additionally, I improved the documentation for both, and added tests for
those and several other config options that weren't completely tested.

Fixes #5.

Issue: https://github.com/Khan/genqlient/issues/5

## Test plan:
make check


Author: benjaminjkraft

Reviewers: dnerdy, aberkan, MiguelCastillo

Required Reviewers: 

Approved By: dnerdy

Checks:  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint,  Test (1.17),  Test (1.16),  Test (1.15),  Test (1.14),  Test (1.13),  Lint

Pull Request URL: https://github.com/Khan/genqlient/pull/77
2021-09-07 09:58:49 -07:00
Ben Kraft d449acdda3 Clarify object type documentation
Craig pointed out this is a bit confusing when you don't have all the
fields.  Now we say so, but still include the type's description in case
it's useful.

Fixes #37.
2021-04-23 18:13:32 -07:00
Ben Kraft 748f2cf072 Add documentation to types and fields
Fixes #3.
2021-04-21 18:07:36 -07:00
Ben Kraft 136ac7729f include alias even if we don't need it 2021-04-15 11:36:46 -07:00
Ben Kraft b4e8316c6a add support for custom scalars -- mainly adding proper import machinery 2021-04-08 13:07:31 -07:00
Ben Kraft cbebeaaed4 rename in code 2021-03-30 12:41:37 -07:00
Ben Kraft 2c52314494 set opname 2021-03-30 11:27:43 -07:00
Ben Kraft 937540d244 make client an interface 2021-03-25 14:08:12 -07:00
Ben Kraft dd85597577 more wiring for configurable context/client, theoretically should be good enough for khan use 2021-03-22 19:17:06 -07:00
Ben Kraft a42c9b8166 clean up various TODOs and comments 2021-03-22 18:11:51 -07:00
Ben Kraft 463e3ed319 remove pointers for optionality -- shockingly easy 2021-03-22 17:39:22 -07:00
Ben Kraft fed38e4f55 redo type naming 2021-03-19 18:40:58 -07:00
Ben Kraft cf7136ca65 total rewrite to interface handling; not complete but it compiles 2020-07-16 13:28:43 -07:00
Ben Kraft 7ab06dfd30 add support for enums 2020-04-10 18:16:32 -07:00
Ben Kraft b600df7877 big refactor to put the codegen onto methods of an object 2020-04-10 15:21:23 -07:00
Ben Kraft dfea9bf128 push type-name into types.go 2020-04-10 14:30:56 -07:00
Ben Kraft af5d1bd542 lowercase for arguments 2020-03-27 18:01:56 -07:00
Ben Kraft 01b903b053 Doc comments 2020-03-27 17:44:30 -07:00
Ben Kraft 9074926cea Set up a test 2020-03-27 15:57:22 -07:00
Ben Kraft 35699a73ef more README stuff, example README, other misc cleanup 2020-01-16 17:56:13 -08:00
Ben Kraft 12605986d0 do our own aliasing if the queries aren't right 2020-01-02 19:01:26 -08:00
Ben Kraft 7dfd03738c genql: bits of whitespace 2020-01-02 18:00:23 -08:00
Ben Kraft 9746c818fd genql: quick hack at variables 2020-01-02 17:52:55 -08:00
Ben Kraft 77670363d3 genql: minor cleanups 2020-01-02 16:40:47 -08: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