Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GraphQL support #5

Open
wan2land opened this issue Jan 26, 2023 · 0 comments
Open

GraphQL support #5

wan2land opened this issue Jan 26, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@wan2land
Copy link
Member

wan2land commented Jan 26, 2023

GraphQL is composed of several depths, and superserial is advantageous for reducing the size of data in these types.

JSON

Content-Type: application/json
{
  articles: [
    { __typename: "Article", id: 1, user: { __typename: "User", id: 1, name: "alice" } },
    { __typename: "Article", id: 2, user: { __typename: "User", id: 2, name: "bob" } },
    { __typename: "Article", id: 3, user: { __typename: "User", id: 2, name: "bob" } },
    { __typename: "Article", id: 4, user: { __typename: "User", id: 1, name: "alice" } },
    { __typename: "Article", id: 5, user: { __typename: "User", id: 1, name: "alice" } },
    { __typename: "Article", id: 6, user: { __typename: "User", id: 2, name: "bob" } },
    { __typename: "Article", id: 7, user: { __typename: "User", id: 1, name: "alice" } },
  ]
}

superserial! 🤩

Content-Type: text/x-superserial
{
  articles: [
    Article{ id: 1, user: $1 },
    Article{ id: 2, user: $2 },
    Article{ id: 3, user: $2 },
    Article{ id: 4, user: $1 },
    Article{ id: 5, user: $1 },
    Article{ id: 6, user: $2 },
    Article{ id: 7, user: $1 },
  ]
}
;User{ id: 1, name: "alice" }
;User{ id: 2, name: "bob" }

similar libraries:

@wan2land wan2land added the enhancement New feature or request label Jan 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant