Ruby graphql-ruby: Difference between revisions

From wikinotes
No edit summary
No edit summary
Line 31: Line 31:
|-
|-
|}
|}
</blockquote><!-- Notes -->


= Syntax =
<blockquote>
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 45: Line 48:
|-
|-
|}
|}
</blockquote><!-- Notes -->
</blockquote><!-- Syntax -->


= Syntax =
= Syntax =

Revision as of 21:35, 5 September 2021

graphql gem for ruby.

Documentation

wiki graphql
docs https://graphql-ruby.org/guides
API docs https://graphql-ruby.org/api-doc/1.12.8/
github https://github.com/rmosolgo/graphql-ruby
homepage https://graphql-ruby.org/

Notes

graphql-ruby basics
graphql-ruby setup
graphql-ruby datatypes
graphql-ruby errors

Syntax

graphql-ruby fields
graphql-ruby objects
graphql-ruby queries
graphql-ruby mutations
graphql-ruby connections

Syntax

Objects

Fields with Arguments

class User < GraphQL::Schema::Object
  field :id, Integer    # name, returntype
  field :age, Integer   # name, returntype
end

class MyGraph < GraphQL::Schema::Object
  field :user, User, do |field|
    field.argument(:id, Integer, required: true)
  end
end