Git Product home page Git Product logo

graphql-ruby-demo's Introduction

graphql-ruby-demo's People

Contributors

cesarandreu avatar esjee avatar irio avatar kimegede avatar lparry avatar noahsilas avatar rmosolgo avatar willianvdv avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

graphql-ruby-demo's Issues

Relay Node Queries Broken?

I've been having a heck of a time over the last couple of days trying execute a Relay query to fetch a node via id. I have been able to reproduce the problem with this project (even running GraphiQL from the Heroku hosted project). Basically, if you try to execute the query located in https://github.com/rmosolgo/graphql-ruby-demo/blob/master/app/graph/queries/introQuery.graphql, you get the following error:

{
  "errors": [
    {
      "message": "Something went wrong during query execution: wrong number of arguments (given 2, expected 1)"
    }
  ]
}

In my own code, I have updated it to use the github repository for graphql-ruby instead of the gem. Now I get a different error:

{
  errors: [
    {
      "message": "Internal error"
    }
  ]
}

Not sure what is going on here. I thought I was doing something wrong, but I'm assuming the query above should work, so perhaps it's a bug?

Please check Error in HeorkuServer

i was try your app in local its work but when i check ur app on heroku it does not work please would you like to check that is error and why
i am new in GraphQL and Rails so i could find it yet

Remove NodeIdentification

NodeIdentification as defined in app/graph/types/node_identification.rb is outdated and can be removed, see http://rmosolgo.github.io/graphql-ruby/relay/object_identification

# Todo: handle code reloads!
GraphQL::Relay::GlobalNodeIdentification.instance_variable_set(:@instance, nil)

NodeIdentification = GraphQL::Relay::GlobalNodeIdentification.define do
  object_from_id -> (id, ctx) do
    type_name, id = NodeIdentification.from_global_id(id)
    type_name.constantize.find(id)
  end

  type_from_object -> (object) do
    StarWarsSchema.types[object.class.name]
  end
end

Question: Schema

@rmosolgo - In this demo, how does graphiql get the schema to show you on the right side bar? Does it do an implicit introspection query when it starts up?

Make a real application

I would like to beef up this application in order to provide examples of more advanced usage. I have a few possibilities in mind:

  • Pick a domain with familiar but interesting data
  • Accept inputs from users (no user-supplied text, though)
  • Make a JS front-end (vanilla JS? Apollo? Relay?)
  • Demonstrate some common practices:
    • GraphQL::Batch + ActiveRecord
    • Relay-compliant mutations
    • Dynamically-generated types and fields
    • Custom Scalar?
    • Simple Authorization

Is there anything else that could be added to make this demo more useful?

Query requires edges

https://github.com/rmosolgo/graphql-ruby-demo/blob/master/app/graph/queries/readLukesFriends.graphql

Running this query

query readLukesFriends {
  luke: human(id: 1000) {
    friends { name }
  }
}

http://graphql-ruby-demo.herokuapp.com/graphiql?query=%7B%0A%20%20luke%3A%20human(id%3A%201000)%20%7B%0A%20%20%20%20friends%20%7B%20name%20%7D%0A%20%20%7D%0A%7D

Returns

"Field 'name' doesn't exist on type 'CharacterConnection'"

But this query works:

luke: human(id: 1000) {
    friends {
      edges {
        node {
          name
        }
      }
    }
  }

Legacy file app/models/query_set.rb and app/graph/queries/ ??

Firstly, thank you so much for this repo, its been incredibly helpful to me. Thanks largely to this repo I've been able to get a batched GraphQL endpoint running over a rainy weekend ๐Ÿ˜„

One thing that I didn't understand, is the QuerySet class legacy, or is it implicitly used somewhere? GH search doesn't show any references to it around the repo.

In addition, the files in app/graph/queries don't appear to be referenced by anyone besides QuerySet, so are these legacy too? I was under the impression that GraphQL provided a way to whitelist queries such that an internal API could not be abused to access unintended data, and wondered if it was related to this directory

Add a date type example?

For a quickstart demo helper, it would be helpful for me to see how to define a date type and use it in a schema

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.