This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.5.0" | |
gem "activerecord", require: "active_record" | |
gem "sqlite3" | |
gem "logger" | |
end | |
# Set up the database for the example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'bundler/inline' | |
gemfile do | |
gem "graphql", "2.4.15" | |
gem "search_object_graphql", "1.0.5" | |
gem "activerecord", require: "active_record" | |
gem "sqlite3" | |
end | |
require 'search_object' | |
require 'search_object/plugin/graphql' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.12" | |
end | |
# This example shows three ways of showing a query's complexity to clients. | |
# All three cases require a customized analyzer which adds the value to be used later. | |
class MySchema < GraphQL::Schema | |
class MaxComplexityWithReport < GraphQL::Analysis::MaxQueryComplexity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "diffy", "3.4.3" | |
gem "graphql", "2.4.11" | |
gem "graphql-enterprise", "1.5.6", source: "https://gems.graphql.pro" | |
end | |
# dummy data | |
THINGS = [{name: "Airplane"}, {name: "Bagel"}, {name: "Calendar"}, {name: "Daffodil"}] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.8", source: "https://rubygems.org" | |
gem "graphql-enterprise", source: "https://gems.graphql.pro" | |
end | |
class MySchema < GraphQL::Schema | |
class SwitchFields < GraphQL::Enterprise::Changeset | |
release "2025-02-01" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.8" | |
end | |
class MySchema < GraphQL::Schema | |
class Vegetable < GraphQL::Schema::Enum | |
value :ZUCCHINI | |
value :ARTICHOKE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.8" | |
end | |
THINGS = [ | |
{ name: "Camcorder" }, | |
{ name: "Magnifying Glass" }, | |
{ name: "Disappearing Ink" }, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.7" | |
end | |
class MySchema < GraphQL::Schema | |
class BaseEdge < GraphQL::Types::Relay::BaseEdge | |
node_nullable(false) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.8" | |
end | |
class Thing < GraphQL::Schema::Object | |
field :name, String | |
# One option is to extend this method to rename the returned type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "bundler/inline" | |
gemfile do | |
gem "graphql", "2.4.7" | |
gem "graphql-enterprise", source: "https://gems.graphql.pro" | |
gem "activerecord" | |
gem "sqlite3" | |
end | |
# Set up the database for the example |
NewerOlder