Questions tagged [graphql-ruby]

a Ruby implementation for GraphQL, a query language used for describing data requirements on complex application data models.

GraphQL is a query language created by Facebook for describing data requirements on complex application data models.

Website graphql-ruby.org

GitHub repository

143 questions
0
votes
0 answers

How can i only query required fields in graphql?

Is there any way that we can only query the required fields instead of querying the whole table every time? For example, if I query like this: query{ locations(id:"", afterUpdatedAt:"2021-08-17", limit:"1", offset:"1"){ …
Hamza Amin
  • 31
  • 5
0
votes
1 answer

ActiveSupport TimeZone not returning all zones

I'm having an issue like this. Not all zones are returning with: ActiveSupport::TimeZone.all.sort_by {|t| t.name}.map { |tz| #symbol = tz.tzinfo.identifier.gsub(/[^_a-zA-Z0-9]/, '_').squeeze('_').upcase! tz.to_s #> (GMT+00:00) Edinburgh for…
Sylar
  • 11,422
  • 25
  • 93
  • 166
0
votes
0 answers

Share common arguments between query types in ruby graphql

What's the best way to share some arguments between different query types. I want to share some common arguments like created_at, updated_at field :products, ProductType.connection_type, null: false do argument :name, [String], required: false #…
ingnam
  • 111
  • 1
  • 9
0
votes
1 answer

How do I allow graphql-ruby to serve app data that is camel-case?

I'm new to graphql-ruby and am running into a problem querying camel-cased data that is being served from an existing application. I've tried to search for some answers in the graphql-ruby tracker but most of them reference mutations, which I'm…
wheresmyspaceship
  • 870
  • 2
  • 12
  • 19
0
votes
1 answer

How to properly update model using graphql-ruby?

I'm working on a side project to learn implementation of GraphQL into a Rails 6 app. To do this, I'm using the graphql-ruby gem. I've got a resolve method to update a Medium model that looks like this: module Mutations module Media class…
J. Jackson
  • 3,326
  • 8
  • 34
  • 74
0
votes
1 answer

Add an additional field to associated GraphQL field return type

I have this GraphQL type in my application. module Types module MyApp class MembersStatus < Types::Base::Object field :active, [Types::MyApp::User], null: true field :on_leave, [Types::MyApp::User], null: true field…
Imam
  • 997
  • 7
  • 13
0
votes
1 answer

Rails Error: block (2 levels) in replace_gem': Error loading the 'sqlite3' Active Record adapter

I've seen other questions asked similar (like this one), however it's slightly different. I created a brand new Rails API app with the command rails new backend -d=postgresql -T --api. I have the database all set up and connecting fine. Now I am…
J. Jackson
  • 3,326
  • 8
  • 34
  • 74
0
votes
1 answer

GraphQL-Ruby. Time type

Per GraphQL wiki I can see that there is the only DateTime type: Link As far as I understood to make only time there should be written additional scalar for that, but I do not have any clue how maybe somebody had already done that and could share…
Viktor
  • 323
  • 4
  • 15
0
votes
1 answer

Unable to call Graphql API using input parameters

I'm able to call a graphql api by passing in the input directy like this mutation { createUser(input: { email: "user+2@example.com", password: "Password123!", passwordconfirmation: "Password123!", firstName: "Richard", …
Antarr Byrd
  • 24,863
  • 33
  • 100
  • 188
0
votes
1 answer

Is it dangerous to return an unpersisted activerrecord with ruby graphql?

In rails, a common pattern I've used is to create a new unpersisted object to populate forms with default values, eg class ContactsController < ApplicationController def new @contact = Contact.new end end ... <%= form_for(@contact) %> I've…
Lintowen
  • 3
  • 2
0
votes
1 answer

Graphql-ruby pagination with limits generates n+1 queries

Imagine that you have users and subscriptions on something. You need to make pagination for user's subscriptions. Each user has a different number of subscriptions. This is the first thing that came in my mind: users =…
0
votes
1 answer

How to use rails Helpers in graphql?

How can I use Helpers from /app/helpers directory in my /app/graphql directory? For example there is a data type which is a nested JSON Object and I got a JSON Schema file which describes the structure of it. There also is a JsonSchemaHelper which I…
0
votes
1 answer

Ruby graphql resolver alternative: method hooking --- how does it work?

I need to add custom fields to graphql response, so I considered implementing my own custom resolver. However seeing this, I asked myself if I really need a custom resolver: First, ask yourself ... Do you really need a Resolver? Putting logic in a…
glinda93
  • 7,659
  • 5
  • 40
  • 78
0
votes
1 answer

Where should I put the requests related to excel export/import on Graphql?

I have an architectural doubt. I am using the GraphQL as an API provider and I need to develop some API requests to import data from excel and to export data to excel on my project. Where should I create this using the GraphQL API? I researched and…
Victor
  • 1,904
  • 18
  • 18
0
votes
2 answers

Can I move my queries out of query_type.rb into their own files/classes?

Usually, in GraphQL/Rails you have a query_type.rb file that would look something like this: module Types class QueryType < Types::BaseObject # Add root-level fields here. # They will be entry points for queries on your schema. field…
aarona
  • 35,986
  • 41
  • 138
  • 186