Sha256: fea9d49bbcd40f9434842c16a01ad27cca3fa5754f60914757dd1a911cd8fdbb
Contents?: true
Size: 1.11 KB
Versions: 2
Compression:
Stored size: 1.11 KB
Contents
# frozen_string_literal: true require 'graphql' require_relative 'types' require_relative 'resolvers' require_relative 'mutation' require_relative 'query' GraphQL::Relay::BaseConnection.register_connection_implementation( ActiveRecord::Relation, GraphQL::Relay::RelationConnection, ) module Osso module GraphQL class Schema < ::GraphQL::Schema use ::GraphQL::Pagination::Connections query Types::QueryType mutation Types::MutationType def self.id_from_object(object, _type_definition = nil, _query_ctx = nil) GraphQL::Schema::UniqueWithinType.encode(object.class.name, object.id) end def self.object_from_id(id, _query_ctx = nil) class_name, item_id = GraphQL::Schema::UniqueWithinType.decode(id) Object.const_get(class_name).find(item_id) end def self.resolve_type(_type, obj, _ctx) case obj when Osso::Models::EnterpriseAccount Types::EnterpriseAccount when Osso::Models::SamlProvider Types::IdentityProvider else raise("Unexpected object: #{obj}") end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
osso-0.0.3.5 | lib/osso/graphql/schema.rb |
osso-0.0.3.4 | lib/osso/graphql/schema.rb |