Sha256: 31dae111b5f60ab5e37653aa502d781981e08da25d7d97d4f70071832888a329

Contents?: true

Size: 803 Bytes

Versions: 35

Compression:

Stored size: 803 Bytes

Contents

# frozen_string_literal: true

require "decidim/api/engine"

module Decidim
  # This module holds all business logic related to exposing a Public API for
  # decidim.
  module Api
    # This declares all the types an interface or union can resolve to. This needs
    # to be done in order to be able to have them found. This is a shortcoming of
    # graphql-ruby and the way it deals with loading types, in combination with
    # rail's infamous autoloading.
    def self.orphan_types
      Decidim.component_manifests.map(&:query_type).map(&:constantize).uniq +
        Decidim.participatory_space_manifests.map(&:query_type).map(&:constantize).uniq +
        (@orphan_types || [])
    end

    def self.add_orphan_type(type)
      @orphan_types ||= []
      @orphan_types += [type]
    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
decidim-api-0.16.0 lib/decidim/api.rb
decidim-api-0.15.2 lib/decidim/api.rb
decidim-api-0.15.1 lib/decidim/api.rb
decidim-api-0.15.0 lib/decidim/api.rb
decidim-api-0.14.4 lib/decidim/api.rb
decidim-api-0.14.3 lib/decidim/api.rb
decidim-api-0.14.2 lib/decidim/api.rb
decidim-api-0.14.1 lib/decidim/api.rb
decidim-api-0.13.1 lib/decidim/api.rb
decidim-api-0.12.2 lib/decidim/api.rb
decidim-api-0.13.0 lib/decidim/api.rb
decidim-api-0.12.1 lib/decidim/api.rb
decidim-api-0.13.0.pre1 lib/decidim/api.rb
decidim-api-0.12.0 lib/decidim/api.rb
decidim-api-0.12.0.pre lib/decidim/api.rb