Skip to content

Extend Wrapping Types with additional primitive Tuple #904

Open
@nalchevanidze

Description

@nalchevanidze

GraphQL Tuples

At this stage, GraphQL does not provide tuples. This issue proposes to extend the GraphQL specification with an additional primitive type Tuple (of kind WRAPPER).

a GraphQL tuple (a₁,...,aₙ₋₁, type) is a list of fixed size n, where the first n-1 arguments can be either enum, scalar, or wrapper types, but the last argument can take any possible type.
accordingly, the selection will be applied only to the last argument.

For example a API with the following schema for query { users { name } }

type User {
  name: String
  age: Int
}

type Query {
  users : [(ID!,User)]
}

will produce the response:

{
  "data": {
    "users": [
      ["jkgad", { "name": "Alex" }],
      ["t9t98", { "name": "John" }],
    ]
  }
}

this way we can support a Map in GraphQL.

Additional considerations of syntax, semantics, and introspection are presented in the morpheus-graphql-proposals

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions