This Rails 8 example project provides some snippets and suggestions to make good use of graphql-ruby.
graphql-rubyError Design and Implementation (Japanese)- Ensuring that the GraphQL schema is committed and up-to-date
- Rearranged directory structure under
/app/graphql/gre/ - Switch
ActiveRecord::Base.connected_to(role:)by whether the query is mutation or not - ObjectTypeRestriction: This prevents unexpected
objectinitialization, e.g. User, Activity, .. - FieldError: This simplifies resolver implementations that use unions to represent possible application errors, e.g. RegisterUser
- Uniformed Union and Interface Resolution based on ObjectTypeRestriction and FieldError
- InlineUnionTypes provides a way to write possible types of unions inline, e.g. RegisterUser
have_graphql_responsematcher
git clone https://github.com/yubrot/graphql-ruby-example.git
cd graphql-ruby-example
bin/setup # or bin/setup --skip-server; bin/dev
# Open http://127.0.0.1:3000/graphiql on your browser# Lint
bin/rubocop -a
# Test
bin/rspec
# Update GraphQL Schema
bin/rake graphql:gre:schema:idl