Hacker News new | past | comments | ask | show | jobs | submit login
Show HN: GraphQL Zeus – Autocomplete GraphQL Queries in JavaScript and TS (github.com)
67 points by aexol 3 months ago | hide | past | web | favorite | 11 comments



First real autocomplete for GraphQL queries in both JS in browser and NodeJS and TS.

Generate library using zeus command:

$ zeus https://faker.graphqleditor.com/aexol/olympus/graphql ./generated

And use it like this

let DionysusCard = await Api(

    'https://faker.graphqleditor.com/aexol/olympus/graphql'

  ).Mutation.addCard({

    card: {

      name: 'Dionysus',

      description:

        'Dionysus is the Greek god of wine, has the power to bring the dead back to life.',

      Attack: 1,

      Defense: 15,

      Children: 9

    }

  })({

    id: true,

    name: true

  });


Wow! Great job! This would be awesome to use together with apollo-client.


Is this not a client library that competes with apollo-client?


You can use it with any stack you want. Apollo is not only a client tool but also many other cool tools for GraphQL. I created this tool for simpler situations. Also here you have query safely typed so you don't have to remember the whole schema.


But I mean you would use this as your client to make queries, in place of apollo client right?


If all I need is communication with GraphQL server then yes. If I need the cache and all the other stuff then I use apollo.


Can babel plugin transpile this to whatever ApolloClient.query consumes?


This is generated code to use in your project before transpilation - that's why it generates declaration files also. However that points me to a conclusion I need to export query generator in generated file so you can use it together with Apollo query


So I was thinking of using the additional features of Apollo client such as caching, network status etc, while leveraging the auto-complete and typesafety of GraphQL Zeus. Auto-complete is what I really miss from Apollo and I feel like the type-generation from gql-tags is a more cumbersome way than what Zeus is doing.


EDIT: I've just found it. I saw this before, this is a totally different approach with many dependencies underneath. Having to install many packages, using specific editor, etc.. This setup might be the best of course, but I am 99% sure it's hard to maintain so many packages to have GraphQL syntax up-to-date. I used it before but was angry they didn't support the new documentation format.

GraphQL Zeus is only one functionality package so it is easier to maintain.


Whats gql-tags? Can you show me?




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: