class Recline::Model

Public Class Methods

field(**kwargs, &block) click to toggle source
# File lib/recline/model.rb, line 15
def self.field(**kwargs, &block)
  # We have to define it fresh each time because
  # its name will be modified and its description
  # _may_ be modified.
  field = GraphQL::Field.define do
    type(Recline::Model.interface)
    description('Fetch the content model for the given object.')
    resolve(Recline::ModelReflection)
  end

  if kwargs.any? || block
    field = field.redefine(kwargs, &block)
  end

  field
end
interface() click to toggle source
# File lib/recline/model.rb, line 5
def self.interface
  @interface ||= GraphQL::InterfaceType.define do
    name "ReclineInterface"
    field('_model', Recline::Types::ModelReflectionType, 'Model of attributes for field.') do
      description('Fetch the content model for the given object.')
      resolve(Recline::ModelReflection)
    end
  end
end