Commit Graph

63 Commits

Author SHA1 Message Date
Ben Kraft f7c81e9997 Actually mark genqlient as ready to use! (#102)
## Summary:
I'm not going to really publicize it until the blog post is done, but
with all the usual boilerplate set up, it's time to remove this note!
(Actually, I meant to do it in #96, but forgot.)

## Test plan:
read it


Author: benjaminjkraft

Reviewers: dnerdy, dangoor, StevenACoffman

Required Reviewers: 

Approved By: dnerdy, dangoor

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

Pull Request URL: https://github.com/Khan/genqlient/pull/102
2021-09-16 12:39:09 -07:00
Ben Kraft 1d6e728181 Add open-source boilerplate (#96)
## Summary:
There's a lot these days!  I got most of it from the GitHub docs [1], as
well as looking at other projects.  I'll probably hold off on landing
this until a couple more things land, then land this and tag v0.1.0.

[1] https://docs.github.com/en/communities

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

## Test plan: view in github UI


Author: benjaminjkraft

Reviewers: jvoll, StevenACoffman, aberkan, dnerdy, mahtabsabet, MiguelCastillo

Required Reviewers: 

Approved By: jvoll, StevenACoffman

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

Pull Request URL: https://github.com/Khan/genqlient/pull/96
2021-09-16 12:05:16 -07:00
Ben Kraft 4d2058c617 Add a bunch more documentation (and rewrite README) (#86)
## Summary:
In this commit, I add a bunch more documentation of how to use
genqlient, including a getting started guide, and a FAQ that also acts
as a how-to shaped index of common configuration options and extension
points.  Much of this is adapted from the internal doc I wrote at Khan,
or reorganized from what was in the README.  Speaking of which, now that
there are better places for all the details, I rewrote the README to be
a bit more of an overview and index of other documentation.  (For now I
left the "unmaintained" notes, which I'll remove fairly soon once all
our ducks are in a row.)

Fixes #26, #39.

Issue: https://github.com/Khan/genqlient/issues/26
Issue: https://github.com/Khan/genqlient/issues/39

## Test plan:
make check, read the docs


Author: benjaminjkraft

Reviewers: mahtabsabet, benjaminjkraft, aberkan, dnerdy, jvoll, MiguelCastillo

Required Reviewers: 

Approved By: mahtabsabet

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

Pull Request URL: https://github.com/Khan/genqlient/pull/86
2021-09-14 11:05:11 -07:00
Ben Kraft 9804d42e2f Make README logo work in dark mode (#87)
## Summary:
Dark mode is, they say, the new thing, and the logo doesn't work super
well with it, because it's black on dark grey.  This is surprisingly
hard to fix.  There are a few options:
- make the logo colored; sorry, but I like black
- add a white border to the logo; this is what Apollo does but I
  think it's pretty ugly in dark mode
- add svg with media queries; this works well but only if the github
  dark mode setting matches the browser(/OS) dark mode setting, since
  that's what the media queries look at
I opted for option 3.  This required converting the text in the SVG to
paths, since it really matters that you have the exact same font.  (I
tested on Android Firefox, which empirically doesn't have the same fonts
I have on desktop.)

Fixes #17.

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

## Test plan:
tested that it looks good on both mobile firefox in dark mode, and
desktop firefox+chrome in light mode.


Author: benjaminjkraft

Reviewers: dangoor, dbraley, somewhatabstract, dnerdy, kevinbarabash

Required Reviewers: 

Approved By: dangoor, dbraley, somewhatabstract

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

Pull Request URL: https://github.com/Khan/genqlient/pull/87
2021-09-10 17:33:01 -07:00
Ben Kraft 2eba9a2c30 Reorganize documentation to make room to grow (#84)
## Summary:
In this commit I reorganize much of our documentation into a new `docs`
directory, where there will hopefully be more room to grow and to
organize things in a user-friendly way.  There's almost no net-new
documentation, although of course it's a great time to review it anyway.

In particular:
- I moved the documentation for the `genqlient.yaml` config file into an
  example file instead of GoDoc (which now just points to the example
  file); I think this will be a lot clearer for casual users.
- I moved the documentation for the `@genqlient` directive out of GoDoc
  and into a GraphQL schema file (since while it's a comment it's all
  real syntax), likewise, and made the `GenqlientDirective` type private
  (since there's now nothing useful to do with it).
- I moved `DESIGN.md` and the logo into `docs/` (just to keep the
  toplevel a bit cleaner), and separated the Contributing section of the
  README into `docs/CONTRIBUTING.md` (which github will automatically
  link on various issue and PR pages).

This leaves it so that:
- README.md is the only documentation at the toplevel (and will become
  just the high-level introduction as I add more user docs to `docs/`)
- GoDoc is only documentation for if you want to call genqlient
  programmatically (which is fairly limited as the API surface is quite
  small: it's now just Main, Generate, and Config, plus a constructor, a
  single method, and a bunch of fields on the latter)

In future commits, I'll add some more new documentation to the `docs`
directory.

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

## Test plan:
make check (and read the docs)


Author: benjaminjkraft

Reviewers: jvoll, benjaminjkraft, aberkan, dnerdy, MiguelCastillo, mahtabsabet

Required Reviewers: 

Approved By: jvoll

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

Pull Request URL: https://github.com/Khan/genqlient/pull/84
2021-09-10 16:03:30 -07:00
Ben Kraft 4a06e3f28e Fix typo in README (#58)
## Test plan
read it

Author: benjaminjkraft

Reviewers: aberkan, dnerdy, MiguelCastillo

Required Reviewers: 

Approved by: aberkan

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/58
2021-08-24 10:20:59 -07:00
Ben Kraft 3746ecd063 Add integration tests against a gqlgen server (#50)
## Summary:
We have lots of tests covering codegen, but not a lot that actually run
the code.  For things where all we do is generate types, that's (mostly)
fine (especially now that we actually build the code), but as we
generate more nontrivial non-type code we need to actually run it.

So I wrote some integration tests that spin up a little gqlgen
server, and make calls to it; we can add more over time especially as
the JSON marshalling logic gets complex (to support fragments).
They're more work to write than the snapshot tests, but of course they
can test a lot more.

In addition to gqlgen, I pulled in testify assert/require, because I
really wanted to be able to use assert.Equal and such for these.  I
didn't bother converting existing tests, although I assume they will
become useful elsewhere in time.  Both gqlgen and testify are of course
only used in tests.

Fixes #21 and #24.
Issue: https://github.com/Khan/genqlient/issues/21
Issue: https://github.com/Khan/genqlient/issues/24

## Test plan:
make check

Author: benjaminjkraft

Reviewers: aberkan, dnerdy, benjaminjkraft, csilvers, MiguelCastillo

Required Reviewers: 

Approved by: aberkan, 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/50
2021-08-20 10:54:41 -07:00
Ben Kraft 700392315a Enable golangci-lint (#49)
## Summary:
It would be nice to have some linting beyond `go vet`!  Now we do.  I
started by copying the config from Khan/webapp.  I did remove a couple
of staticcheck checks that I didn't feel were useful.  (Note also that
exportloopref is the replacement for scopelint in newer golangci-lint.)

Included are all the needed lint fixes; most are stylistic but the
changes in the example are a (minor) bugfix.

Fixes #22.
Issue: https://github.com/Khan/genqlient/issues/22

## Test plan:
make check

Author: benjaminjkraft

Reviewers: aberkan, dnerdy, benjaminjkraft, csilvers, MiguelCastillo

Required Reviewers: 

Approved by: aberkan, 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/49
2021-08-20 10:39:12 -07:00
Ben Kraft b399e0d740 move TODOs into issues 2021-04-21 19:05:38 -07:00
Ben Kraft 288657fcb9 TODOs 2021-04-16 11:55:35 -07:00
Ben Kraft 74411faf52 TODO: auto-caching 2021-04-09 12:18:09 -07:00
Ben Kraft 16523c1f81 add omitempty 2021-04-09 11:51:30 -07:00
Ben Kraft 25a2b45ccc redo comment parsing to set up for field-level config 2021-04-09 09:53:53 -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 e68787ad35 add TODO 2021-04-08 11:28:10 -07:00
Ben Kraft eae8553c04 couple more TODOs 2021-04-06 15:49:52 -07:00
Ben Kraft a33595b4b3 update & reorganize TODOs 2021-04-06 15:44:03 -07:00
Ben Kraft e7d9c7d140 update repo to match official open source guidelines 2021-04-06 12:29:28 -07:00
Ben Kraft 28dfeb5b46 more notes on testing 2021-04-02 18:08:13 -07:00
Ben Kraft 9c8cf02181 proper test wiring for example test in github actions 2021-04-02 18:04:05 -07:00
Ben Kraft 21954ac62d general pass of README cleanup 2021-04-02 17:01:49 -07:00
Ben Kraft 0432f3f434 miscellaneous test coverage 2021-04-02 16:34:15 -07:00
Ben Kraft 4669ea00d0 TODOs 2021-04-02 16:26:22 -07:00
Ben Kraft fbf00f3bef add option to export all operations 2021-04-01 13:11:23 -07:00
Ben Kraft eae68e43c9 allow globbing, and extract queries from .go files 2021-04-01 12:34:51 -07:00
Ben Kraft 10ae5ff5d8 formatting 2021-03-31 18:09:50 -07:00
Ben Kraft 27ee3c2dbd fixes while integrating into webapp 2021-03-30 17:53:31 -07:00
Ben Kraft be8952f11a embed png because fonts 2021-03-30 13:23:16 -07:00
Ben Kraft cf1965160b logo of sorts 2021-03-30 12:59:39 -07:00
Ben Kraft 315617261d silliness 2021-03-30 12:48:35 -07:00
Ben Kraft 470222e118 check some boxes off the README 2021-03-30 12:46:03 -07:00
Ben Kraft cbebeaaed4 rename in code 2021-03-30 12:41:37 -07:00
Ben Kraft db3ee65854 Rename and do some fun heading nonsense in the README 2021-03-30 12:39:59 -07:00
Ben Kraft f136758db4 misc bits of documentation 2021-03-25 14:13:14 -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 17a95fd4de more TODOs, and especially clarify the situation for input type names 2021-03-22 18:45:52 -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 58f4aff83b more design updates -- clarify what's decided and decide some things 2021-03-19 17:22:23 -07:00
Ben Kraft 5accc088c5 more docs about design and what remains to be done 2021-03-16 19:01:45 -07:00
Ben Kraft 8d46de3a9b Bit more detail on what we need to use non-fragment queries in prod 2021-03-16 12:42:43 -07:00
Ben Kraft f3282426f2 TODOs 2020-09-04 17:14:40 -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 af4a765a32 back out interfaces/unions, in preparation for new approach 2020-07-16 09:53:21 -07:00
Ben Kraft d2d5c9469d notes on approaches to the interface/fragment problem 2020-07-15 17:36:24 -07:00
Ben Kraft 6f0e5fdf0d unions are easy too, sorta 2020-07-15 17:35:47 -07:00
Ben Kraft d089ab1afb test, and clean up, support for __typename 2020-07-15 17:35:47 -07:00
Ben Kraft cf6f57f5f1 interfaces themselves are actually trivial! 2020-07-15 17:35:47 -07:00
Ben Kraft 3b80f09c79 reword TODO 2020-07-10 13:59:35 -07:00