GraphQL WG ·

GraphQL WG meetings · Jump to notes

Agenda

View agenda on GitHub

GraphQL WG – October 2021

The GraphQL Working Group meets monthly to discuss proposed additions to the GraphQL Specification and other relevant topics to core GraphQL projects. This is an open meeting in which anyone in the GraphQL community may attend. To attend this meeting or propose agenda, edit this file.

Attendees

Guidelines

  • Before attending, you (or your organization) must sign the Specification Membership Agreement.
  • To respect meeting size, attendees should be relevant to the agenda.
  • If you're willing to take notes, add "✏️" after your name (eg. Ada Lovelace ✏)
  • Include the organization (or project) you represent, and the location (including country code) you expect to be located in during the meeting.
  • Read and follow the participation guidelines and code of conduct.

By joining the meeting you consent to being recorded and agree to the Specification Membership Agreement, participation guidelines, and code of conduct. Meetings may be recorded, by joining you grant permission to be recoded.

NameGitHubOrganizationLocation
Lee Byron@leebyronGraphQL FoundationSan Francisco, CA, US
Alex Reilly@twofYelpSan Francisco, CA, US
Michael Staib@michaelstaibChilliCreamZurich, CH
Benjie Gillam ✏@benjieGraphileChandler's Ford, UK
Morris Matsa@mmatsaIBMBoston, US
Jordan Eldredge@captbaritoneFacebookSan Francisco, CA, US
Laurin Quast@n1ru4lThe GuildHeidelberg, DE
Noj Vek@nojvekRecurrencySeattle, WA, US
Tim Suchanek@timsuchanekGraphCDNBerlin, DE
Hugh Willson@hwillsonApolloOttawa, ON, CA
Ivan Goncharov@IvanGoncharovApolloLviv, UA
Du Genkui@dugenkui03GraphQL CalculatorBeiJing, CN
Robert Zhu@robzhuAWSSeattle, WA
Matt Mahoney@mjmahoneFacebookNew York, NY, US
Sasha Solomon@sacheeTwitterPortland, OR, US
Stephen Spalding@fotoetienneNetflixLos Gatos, CA, US
ADD YOUR NAME ABOVE TO ATTEND

Agenda

Guidelines

  • To cover everything, discussion may be time-constrained. Topics that require less time should be covered first. Most topics take 15-30 minutes.
  • Include any and all relevant links (RFC, issues & PRs, presentations). If there are no relevant links, open an issue to provide context and link to that.
  • Read the spec contribution guide.
  1. Agree to Membership Agreement, Participation Guidelines and Code of Conduct (1m, Lee)
  2. Introduction of attendees (5m, Lee)
  3. Determine volunteers for note taking (1m, Lee)
  4. Review agenda (2m, Lee)
  5. Review previous meeting's action items (5m, Lee)
  6. Update on the status of the Nullability RFC (5m, Alex Reilly)
  7. Argument name uniqueness - advance stage? (5m, dugenkui and/or Ivan)
  8. Oneof discussion (20m, Benjie)
  9. Map types discussion (20m, Noj)
  10. Allowing description on executable defintions (10m, Ivan)
  11. Add why field to GraphQL Errors (10m, Ivan)
  12. ADD YOUR AGENDA ABOVE

Notes

View notes on GitHub

GraphQL WG Notes - October 2021

Watch the replay: GraphQL Working Group Meetings on YouTube

Agenda

Agree to Membership Agreement, Participation Guidelines and Code of Conduct (1m, Lee)

Determine volunteers for note taking (1m, Lee)

  • Benjie
  • Stephen

Review agenda (2m, Lee)

  • All good.

Review previous meeting's action items (5m, Lee)

Update on the status of the Nullability RFC (5m, Alex Reilly)

  • GraphQL.js Implementation
  • Doc listing important test cases: https://docs.google.com/document/d/1relgXUdhJrlaSR70lrITQKmcIHXjIVyWxDCKRuzMEvs/edit#heading=h.gm7m1frqgtc4
  • Alex: We might want to make our branch work with a client library - wise?
  • Lee: yes.
  • Alex: Apollo have suggested we use The Guild's CLI GraphQL tool.
  • Tim: Urql authors work at GraphCDN so we can encourage them to have a look.
  • Lee: what are you still exploring? Previously query validation (field merging - two fields where one uses ! and one does not - is that allowed or not?)
  • Alex: they're treated like they're different types, so they merge as if they were different types (i.e. not allowed); can be worked around by aliasing but if one is null then it blows up the whole thing so is kind of nonsensical.
  • Jordan: we present a facade of fragments being isolated, so we might implement the behaviour at runtime isolated at the fragment level (stripping out the ! from operation sent to the server) - we're happy with this divergence.
  • Alex: we have a doc with other problems - marking list items as non-required is an issue. Relay/Netflix haven't ran into this problem, but it's worth thinking about an upgrade path if we can implement this in the future.
  • Lee: it would be super useful to have that doc {in GitHub?}, that way we can give people more liberal access to commit/merge rights. Helps to keep people up to date with the "long tail" of issues. (Just offering this as an option.)
  • Alex: we're looking for feedback. We're good on the path forward. Is there anything else to do (other than PR to GraphQL-spec)?
  • Lee: changes to spec via PR would be helpful - I found it helpful rewriting the code and writing the spec text at the same time because it makes sure that you're handling both sides of the problem.
  • Lee: thanks for your work on this - I'm excited about it! Great progress.

Argument name uniqueness - advance stage? (5m, dugenkui and/or Ivan)

  • Latest PR
  • GraphQL.js PR
  • Ivan: Discussed in GitHub issue, Du has asked me to present it.
  • Initial confusion: there's 3 PRs with this proposal in the repo; one initial PR with CI issues, now recreated. I also had a PR to move this proposal further so independently filed the changes (forgetting that this PR existed!) and fun fact - it ended out basically exactly the same!
  • Ivan: I've created a GraphQL.js PR, it's a little out of date but everything is there including test cases and description of what the problem is about.
  • Ivan: the proposal is to add validation to type system to forbid duplicate arguments. Technically you cannot specify duplicate arguments in queries, but you can specify duplicate argument definitions. The only breaking that I can think of is breaking really weird introspections.
  • Aim is to move it to stage 2 and merge the GraphQL.js PR.
  • Lee: this is about unique argument definitions; we already have one for unique arguments - correct?
  • Ivan: yes.
  • Lee: I agree this is non-controversial.
  • Matt: completely non-controversial in my opinion.
  • Benjie [chat]: ship it.
  • Lee: I'm going to ship it - stage 2. We'll probably move it stage 2 to 3 at or before the next meeting. Thanks for the careful read; great work!

Oneof discussion (20m, Benjie)

  • New syntax proposal
  • Discussion around usage in output (inspired by Min Chen of LinkedIn at GraphQL Conf / rest.li union type)
  • Benjie: Haven’t done much work on this recently - not 100% certain that this is the right way to go
    • Rethinking the syntax a bit. Syntax does matter.
    • If we apply it to field arguments, a directive would be awkward
    • Proposal: Use a oneof keyword either before field or before parenthesis defining argument for field
  • Laurin: makes sense. We implemented using directive and it was awkward
  • Lee: Not so sure. This feels like we’re making the solution for inputs more complicated in order to make the arguments case easier. Arguments was not an original goal
    • Alternate proposal: (it’s a tradeoff, so let's discuss) If we use a directive on input object, if you have a set of arguments that you want to limit, use an input object. This might make it more obvious that there’s something there that is different. Id does make this case more awkward, but it allows us to scope this down to input objects
  • Laurin: Agree, using an input object feels more natural
  • Ivan: I was a proponent of keeping symmetry with arguments. (default values, etc) Now I think it is an anti-pattern. If you do oneof on a field it means you can’t add another argument at all.
  • Matt M: CLI arguments - one clever thing is argument groups. A group of arguments that we accept, exactly one-of is valid. You can add additional arguments that aren’t part of the group.
  • Stephen S: Keeping the impl simpler with a
  • Benjie: We might revisit this later and change our minds. Keyword could allow that
    • It feels like a new type
    • Is oneof a big parser change?
  • Lee: The main question - is it a meaningfully new thing?
    • A keyword might be confusing because of its location and behavior and similarity. PArticularly for someone who hasn’t spent time thinking about input unions.
  • Benjie: Seems reasonable.
    • My intent was always a bit broader
    • There are use-cases where additional arguments seem unnecessary.
  • Benjie: It feels wrong to have polymorphism on input that is so distinct from polymorphism on the output
    • We could have a lot more polymorphism that allows scalars, lists, same type with multiple labels
    • It feels wrong to have more polymorphism on input than on output
    • Thinking about polymorphism on output. MongoDB for example can express things that GraphQL can’t. That is OK, we don’t need to have parity, but there are situations where these exist and more people needing to convert these data stores. Min Chin from LinkedIn mentioned rest.li that they want a GraphQL layer over. Automatic conversion. They have a type in REST APIs that is almost exactly what I’m thinking of for output polymorphism. They call it unions. Currently, they’re converting it to GraphQL object types with exactly one field set (basically “oneof”).
    • It feels wrong to only do oneof on input
    • If we remove that symmetry, we should re-evaluate the other solutions given that this solution would no longer have the symmetry advantage
  • Lee: I agree, main advantage was the symmetry.
    • I don’t agree to the extreme that we need to have it work for outputs, but it would be good
    • 100% on the broader vision of having parity on input and output
  • Benjie: If we want to extend oneof on output, does it mean that any of the other solutions are now better? At the end of the day, I want what is best for GRaphQL
  • Ivan: If it works for input, it is good by itself.
    • For input, you send one over the network. For output, you are describing what is available. Client only gets it if they know to ask. Natural codegen is enums.
    • For me, the input case is way simpler. I propose we advance even if we’re stuck on the output case
  • Lee: This is also a problem with our existing unions - if you add a new case, clients that don’t know about it get nothing
    • Inputs, you can have an old client that doesn’t know about oneof and it will keep working.
  • Laurin: There is a workaround, but it’s complicated (the server can interpret the covered types in the sent query document selection set and handle missing members that got added to the union afterwards differently). On top of that if we have oneof object types, do we still need unions? It could be confusing.
  • Benjie: If we introduce this we would probably recommend it over union
    • Typename when you haven’t asked for a specific type. Oneof currently, you get no information
    • Unions are flatter
    • With union you can do fragment spread over one of the types in the union
    • We could potentially add __fieldName to indicate which of the fields is present
    • That might be an optimisation for codegen - e.g you can use a discriminated union in TS

Map types discussion (20m, Noj)

  • Map types proposal
  • Discussion around semantics and resolution
  • Manoj: Similar to aliases but this would be a transformation on lists
  • Manoj: (context) Imagine you have a type User { id: ID! name: String, profileUrl: String!}; in GraphQL you might add a field users: [User!]. What if you want the users keyed by the ID? E.g. {1: {name: "Foo"}, 2: {name: "Bar"}, ...}. E.g. in GitHub's API you could make a dictionary of all the repositories within a particular organization.
  • In most clients a map lookup is O(1) whereas a list search is O(N).
  • You could do a query such as { organization(login: "graphql") { repositories { [name]: { ...RepoFrag } } } to get a dictionary of the repositories by their name
  • Ivan: I don't really use GraphQL (so I don't have use cases), but people with use cases may want to jump in.
  • Ivan: I'm against server-side map for multiple reason:
    • what indexes to use? opinionated
    • ordering. Previously we required fields to be sent in same order as query, but Go users had issues because Maps are unordered, so we changed to say that this is recommended but not required (JSON maps are technically unordered - order is not guaranteed).
  • Discussed some variants; had questions. List of lists could become just a map.
  • We could restrict the key so that it can only be an ID! field.
  • Manoj: will GraphQL enforce that ID is unique?
  • Ivan: No.
  • Manoj: so it's effectively equivalent to String!
  • If it's a transform of the list should GraphQL do it or should it be done in userspace?
  • GraphQL aliases make it very easy to have fast lookups.
  • Matt: I've strong opinions and have commented as such.
  • Manoj: Ivan, you had strong opinions on duplicate keys - do you think they should throw errors or overwrite?
  • Ivan: I think it's an edge case.
  • Map type initially suggested in #101 back in 2015 and has a lot of :+1:'s.
  • Ivan: HTTP headers are key-value pairs. In GraphQL [the response body] it's optimised to render all the values, it's not optimised for quick lookup - you have to do a transform. Working with key-value pairs is hard [in GraphQL].
  • I wrote a query to pull changelogs from GitHubs API and had to do aliases for each repo, but because the repository names do not match up with Name in GraphQL I have to sanitise them and it ends up being quite ugly.
  • If you have a big amount of data you'll use pagination anyway; and for small data O(1) vs O(N) is not a big difference. GraphQL says you can get the data that you want - question: can we get it in the shape that we want?
  • Manoj: I agree, well expressed.
  • Matt: there's no way to differentiate it in the response from an object - it looks the same as an object type. With lists we know it's different because it uses list syntax. The other issue is that not all languages support maps in the way (e.g. in C++) - the way that you'd use a JSON map, the lookup semantics will be different. Normally they're backed by a list of pairs. Given that, there's a real need for "user supplied generic types" - we have no way of describing a pair that the client system can operate over generically - e.g. getting a list of this pair can be treated as a map, regardless of how it's coming over the wire.
  • Critical point: GraphQL is not a JSON spec - JSON is not a prerequisite for GraphQL. You can return it in a more optimised format; adding a new map type would add complexity to that. User created generic types might make it easier to do what you want without every client having to do the same thing.
  • Lee: I think what Matt's proposing here is intriguing; all in user space, adding generics would really complicate our type system though. If we really want to support generic maps (key value pair); the right way to represent that in the response would be a list of tuples (or key-value pairs); that would allow you to skip past this whole suite of problems: strings or other? Nullable or non-nullable? Also side-steps ordered/non-ordered. Why this is unpopular -> users want the raw JSON to give them a JSON object. #101 threw up a lot of problems, and this Map type would not solve them all. Some people just want untyped JSON-style values.
  • Your proposal is interesting and compelling but doesn't necessarily pass our guiding principles - it goes against simplicity over expressiveness, it doesn't really enable something that's not currently possible.
  • Manoj: JSON has that keys are always strings.
  • Matt: the connection specification (how Relay deals with "types whose name ends in Connection") is effectively creating a map type that allows you to paginate through it as a map - but it's a handshake that the server and client agree that client can ask server for next or previous element after/before each element in the map. What would a map generic type be like; can we make the language simplify this / make it clearer / make it easier to use?
  • Lee: we need to take ourselves out of the JS world, JSON is an easy way to pin things on; but JS maps (before ES6 Maps) don't necessarily work in the same way as other languages.
  • We should look at the problems, find out the most important, and then see how to address those. Some might just be patterns for solving them with the existing spec. We want to pare it down to the set of problems that you're most interested in solving (as the champion).
  • Lee: Thanks for the work on this, this is the most valuable conversation we've had on this topic so thanks!

Allowing description on executable definitions (10m, Ivan)

  • Previous discussion
  • Spec proposal
  • Ivan: we discussed this in a call that had a very short agenda. This was my proposal. Originally I thought this was for a weird use case, but it turns out it's pretty popular. E.g. when you generate from your operation documents in large code bases (especially when queries/fragments live in separate files) it's useful to have descriptions for them. GraphQL used to use comments as descriptions, but we've moved to a dedicated syntax for them in the schema; this proposal is to extend this new syntax to queries, fragments, mutations and subscription operations.
  • Comments and descriptions are different - e.g. in comments you might have TODO whereas in descriptions it's more descriptive. Descriptions can be useful to add to generated code.
  • Spec change is small - grammar to allow it and a new paragraph.
  • I don't think it makes sense to add description to the short form (where query keyword is omitted) so haven't added that.
  • Matt: does this allow comments on operation variables?
  • Ivan: yes :)
  • Matt: the only thing with adding description strings on arguments/variable definitions is that it would be easy to screw up and confuse it for a default value. Not sure how big a concern that is.
  • Lee: this is the same problem as input field definitions and their default value definitions.
  • Benjie: A GraphQL minification lib could strip these out (like whitespace). Might someone try to leverage these instead of directives and cause problems?
    • That said, I think it’s a really good idea and I think we should add it
  • Manoj: JSON deliberately didn't add comments so that this kind of problem couldn't exist.
  • Ivan: we already have comments, descriptions and directives. You could use comments to do this thing, so we've already paid that price. People could use description to do client-specific stuff; e.g. to disable a lint check on a particular query - but comments are a better way of doing this. It can already be abused.
  • Benjie: but descriptions would be added to the AST whereas comments would not be? So it could be pulled from resolveInfo in GraphQL-js for example?
  • Ivan: we're already looking at adding comments to the AST.
  • Lee: we were using this for descriptions before SDL so the code's already there.
  • Matt: we wanted it at Facebook because we use graphql-js for our tooling and wanted to be able to print out the AST without comments being stripped.
  • Stephen: add a non-normative note that servers should treat comments and descriptions as whitespace/non-meaningful.
  • Ivan: I agree; we should go even more powerful and say that query with and without description are strictly equivalent - totally safe to strip them.
  • [Retrospectively apply this to comments too]
  • Ivan: good idea.
  • Morris: server could use the descriptions.
  • Lee: should not affect validation, execution or response.
  • Ivan: I'll retrospectively add this text for comments also.
  • Lee: I like this; this is very aligned with one of the principles of GraphQL - documentation as a first class concept.
  • Ivan: no-one opposed to moving it to stage 1; I'll aim to build a GraphQL.js implementation by next WG.
  • Lee: agreed -> Stage 1.

Add why field to GraphQL Errors (10m, Ivan)

  • Spec RFC
  • Ivan: there's two use cases and one solution. Proposal first.
  • When multiple errors have the same path it's confusing and bad DX. GraphQL Tools uses "aggregated error" allowing you to supply an array of errors and a description. Tools like GraphiQL don't handle it well when you point multiple errors to the same location.
  • Parallel execution or complex validation may result in multiple errors ultimately for the same field.
  • Lee: seems useful; I've seen this problem in many cases so aggregated messages seems useful. Do you see it being potentially recursive? Could you have an error with a why of another error with a why of another error?
  • Ivan: my experience is coming from GraphQL-js; if you are returning something between boundaries it's complex to put all the information into one error. We have error from GraphQL-js itself and error from client code; there's no way to present both without concatenation. This issue solves that. Clients should try as much as possible to do concatenation/joining. We could allow some chaining, but I'm against chaining to error - it should have same attributes but it must not have locations.
  • Morris: this seems useful; but does this make it more complex than it needs to be for the user? Choosing how the error is concatenated on the server means everyone gets the same expression whereas doing it on the client could make this less consistent.
  • Ivan: buildSchema (?) accepts SDL and produces error containing newlines. It's very hard to read. One string with semicolons or newlines is hard for person to read - it's not markdown or formatted. Newlines as escape sequences is also hard for readability.
  • Lee: I think this is a smart idea. I like that we can merge the two concepts into one idea.
  • Ivan: this is the first field introduced after enforcing "extensions" so that paid off and we can now add this without conflicting with vendor-specific stuff.
  • Lee: I think this is worthy of stage 1.
  • Do we get any value out of the box for this, examples in the existing repo?
  • This is great - thanks for your work on this, Ivan!

Tracked RFCs