Commit Graph
14 Commits
Author SHA1 Message Date
Ben KraftandGitHub 6fdb170b99 Fix type-naming in the presence of interfaces, and refactor it a lot (#71)
## Summary:
When adding support for interfaces, I did not do the type-names as I
intended: they came out to be `MyFieldMyType`, not
`MyInterfaceMyFieldMyType`, which is inconsistent, but not strictly
wrong.  But once supporting fragments, this is also now incorrect.
(Exactly why is described in the comments inline.)  In this commit, in
any case, I fix it.

To do that, I finally did the last of the refactors I've been hoping to
do but unable to successfully implement, which is to make the type-name
and type-name-prefix management clearer.  In the past it was kind of
spread out, and each caller would have to pass the right name into
`convertDefinition`, which go quite unwieldy.  Now, the case that really
wanted that -- the operation toplevel -- just does it own thing; and the
main name-generation code  is factored out into a separate file with
tests, and with a long comment that goes into all the details of the
algorithm that the design-doc didn't cover.  (I even had some fun using
a linked list to implement the prefix-stack!)

This allowed me to fix the above bug fairly easily -- actually the fix
was pretty much automatic once I understood how to organize things.
There is one change which is that if your query name is unexported, we
no longer do the same with the input-type names; it's unclear to me if
anyone will actually care about this behavior (Khan always makes the
queries exported) but if they did it was very inconsistent (only at the
query toplevel, and only for input-objects, not enums), so we can
reimplement it properly if that comes up.  As a bonus fix, we now better
handle the case where your type-names are lowercase, which is legal if
nonstandard GraphQL.

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

## Test plan:
make tesc


Author: benjaminjkraft

Reviewers: dnerdy, benjaminjkraft, 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/71
2021-08-30 10:50:11 -07:00
Ben KraftandGitHub e99dced757 Add support for fragments, part 0: design sketch (#59)
## Summary:
Having implemented support for interfaces, it's time to implement
support for fragments.  And it turns out there's actually another design
decision I hadn't really thought about when thinking about interfaces!
In this commit I add a sketch of the design -- two proposed designs
really.  This one I think will be easier to change later (via a flag),
but opinions are still welcome.

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

## Test plan:
read it


Author: benjaminjkraft

Reviewers: dnerdy, benjaminjkraft, aberkan, csilvers, 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/59
2021-08-27 18:04:38 -07:00
Mark SandstromandGitHub 832c0bf855 Correct string zero value in design doc (#53)
The design doc talks about the zero value for the `string` and `*string` types and then references `0` and `null`. This PR changes these values to `""` and `nil`.
2021-08-19 18:03:35 -07:00
Ben KraftandGitHub 589680f323 Notes from meeting about content-library
In general it seems like they are happy with the potential future fragments plan!
2021-05-11 14:32:11 -07:00
Ben KraftandGitHub 870284271a Some more ideas on how to allow fragments for code-sharing
And clarified some existing ideas and tradeoffs.  This is enough to
make me think we may not need to implement both options, at
least to start.
2021-04-30 16:55:11 -07:00
Ben KraftandGitHub f97d33e6ae more design notes on interfaces/fragments 2021-04-21 10:23:03 -07:00
Ben KraftandGitHub 19cd9a01f7 formatting 2021-03-31 18:09:34 -07:00
Ben KraftandGitHub 291ce980b3 another idea on query extraction 2021-03-31 10:43:08 -07:00
Ben Kraft cbebeaaed4 rename in code 2021-03-30 12:41:37 -07:00
Ben Kraft 59ca841a6b start of wiring for configurable context 2021-03-22 19:09:17 -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 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