false field :title, String, null: false field :thumbnail_url, String, null: false end class QueryType < Types::BaseObject field :articles, [ArticleType], null: true field :article, ArticleType, null: true do argument :id, ID, required: true end def articles; Article.all; end def article(id:); Article.find(id); end end class AppSchema < GraphQL::Schema query QueryType end post "/graphql" do AppSchema.execute( Params[:query], Params[:variables] ).to_json end