Git Product home page Git Product logo

graphoid's People

Contributors

dependabot[bot] avatar maxcoto 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

Watchers

 avatar  avatar  avatar

graphoid's Issues

Multiple Queries support on Graphoid

Hello @maxiperezc

Firstly, congratulations for your Graphoid gem, which automatically creates the basic GraphQL Queries and Mutations via ruby metaprogramming.

I wanna ask you a question regarding an issue, I believe a feature is not implemented on Graphoid yet...

How can I perform Multiple Queries on Graphoid?References: https://hasura.io/docs/1.0/graphql/manual/queries/multiple-queries.html

On GraphQL, it is possible to perform Multiple Queries. However, somehow, the Graphoid gem is restricting this feature.
In fact, an error is being shown when trying to perform multiple queries
Please, take look at the below picture..

Screen Shot 2020-04-24 at 19 48 14

With single queries, it works wonderfully, but I need to do multiple queries in my project :/

Screen Shot 2020-04-24 at 19 31 00

If it is not yet implemented on the Graphoid gem, can you give me an idea where I need to touch to enable this feature?

I'm willing to play with with Graphoid's internal code in order to make Multiple Queries this possible.

Best regards;
Thank You very much!

--

Relationships break in ruby-graphql >= 1.9

Hi! Love this gem, thanks for creating it!

I've had issues implementing it in a project and isolated it to the fact that we used ruby-graphql >=1.9. Upgrading the root .gemspec and the tester_ar project to 1.9 allowed me to reproduce this.

The relationships are not being added to the queries as they were before. However, relocating the include Graphoid::Queries to the bottom of the model classes (or just below all relationship definitions) will add some of these, depending on the order they're being mapped over by Graphoid::Types. For instance, the User model goes first, and the Graphoid::Queries::LIST is empty, while Account goes last and is able to add User relations due to it being present in LIST by that point.

I've been looking through the ruby-graphql changelog for 1.9.0 and can't really identify some obvious reason for this to break. I checked ruby-graphql 1.8.17 which works as expected.

I'll continue investigating this...

Where to add authorization?

Hey @maxiperezc!

Thanks for the great gem! I'm really curious to give it a try in my app. :)

I'm trying to figure out where I'd add authorization, so that I can, for example, restrict access to non-published Posts, or prevent user/guest from creating new Blogs, etc.

I've found Permissions section in the docs, but (as far as I understand) it's actually only for hiding certain fields from the API.

Thanks!

Alternative to eager loading?

Hi. First of all thanks for this gem. I'm trying to incorporate it into an existing rails 5.2 application but run into some weird/fun loading issues. In various initializers I have pieces of code that is required for my application to boot. For example I define a class that the application code uses etc. When I install graphoid by adding the gem to the bundle and creating the initializer as per the instructions, I would get errors for example for this missing class. If I rename config/initializers/graphoid.rb to config/initializers/zz_graphoid.rb (so it is the last initializer to run), booting the app works as expected.

From looking at the sourcecode of the gem I suspect it's because it asks rails to eager_load. I could be wrong :)

Is there an alternative approach? Relying on the load order seems a little brittle... :)

n+1 queries issue

Right now has_many association still have N+1 issue:

Entity Load (1.0ms)  SELECT "entities".* FROM "entities" WHERE "entities"."deleted_at" IS NULL
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (5.9ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "b0d49d56-16d2-4d9f-a946-db7504271799"]]
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (0.3ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "1a9bfbec-b2e6-4eb8-a64b-17a3ae77cf2a"]]
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (0.3ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "c88f263b-eea1-43cb-9a8d-acf55014a875"]]
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (0.3ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "8adb8c4a-bc72-4d9d-932d-5e2a34a65fdb"]]
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (0.4ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "c3892ae1-f9e3-487c-9224-4a28b097b575"]]
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (0.3ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "0d350ec8-9b81-4194-8623-3f5079173c89"]]
  ↳ app/controllers/graphql_controller.rb:10
  Location Load (0.2ms)  SELECT "locations".* FROM "locations" WHERE "locations"."deleted_at" IS NULL AND "locations"."entity_uuid" = $1  [["entity_uuid", "78a38941-a0c1-4066-b740-d9382bf6b78f"]]
  ↳ app/controllers/graphql_controller.rb:10

You may want to take a look at this link: https://graphql-ruby.org/schema/lazy_execution

Not compatible with rails 5.2.2

Fetching [email protected]:maxiperezc/graphoid.git
Resolving dependencies...
Bundler could not find compatible versions for gem "rails":
  In snapshot (Gemfile.lock):
    rails (= 5.2.2)

  In Gemfile:
    rails (~> 5.2.2)

    graphoid was resolved to 0.0.5, which depends on
      rails (~> 5.1.6)

Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.

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.