Skip to content

Commit

Permalink
Merge pull request #494 from datacite/graphql-autoload
Browse files Browse the repository at this point in the history
Graphql autoload fixes
  • Loading branch information
Martin Fenner authored Apr 30, 2020
2 parents fe5ea9a + 8a4f2a7 commit 3139b56
Show file tree
Hide file tree
Showing 197 changed files with 554 additions and 547 deletions.
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ gem "rack-utf8_sanitizer", "~> 1.6"
gem "turnout", "~> 2.5"
gem "audited", "~> 4.8"
gem "git", "~> 1.5"
gem "graphql", "~> 1.9.16"
gem 'graphql', '~> 1.10', '>= 1.10.8'
gem "graphql-errors", "~> 0.4.0"
gem "graphql-batch", "~> 0.4.1"
gem "batch-loader", "~> 1.4", ">= 1.4.1"
gem 'graphql-cache', '~> 0.6.0'
gem 'apollo-federation', '~> 1.0'
gem 'apollo-federation', '~> 1.0', '>= 1.0.4'
gem "google-protobuf", "3.10.0.rc.1"
gem "sprockets", "~> 3.7", ">= 3.7.2"
gem 'uuid', '~> 2.3', '>= 2.3.9'
Expand Down
29 changes: 16 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ GEM
audited (4.9.0)
activerecord (>= 4.2, < 6.1)
aws-eventstream (1.1.0)
aws-partitions (1.298.0)
aws-partitions (1.305.0)
aws-sdk-core (3.94.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (~> 1, >= 1.239.0)
Expand All @@ -69,17 +69,17 @@ GEM
aws-sdk-kms (1.30.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.61.2)
aws-sdk-s3 (1.63.0)
aws-sdk-core (~> 3, >= 3.83.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sdk-sqs (1.24.0)
aws-sdk-core (~> 3, >= 3.71.0)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.2)
aws-sigv4 (1.1.3)
aws-eventstream (~> 1.0, >= 1.0.2)
base32-url (0.5)
batch-loader (1.4.1)
batch-loader (1.5.0)
bcrypt (3.1.13)
benchmark-perf (0.4.0)
benchmark-trend (0.2.0)
Expand All @@ -94,7 +94,7 @@ GEM
oj (>= 2.8.3)
pandoc-ruby (~> 2.0, >= 2.0.0)
safe_yaml (~> 1.0, >= 1.0.4)
better_errors (2.6.0)
better_errors (2.7.0)
coderay (>= 1.0.0)
erubi (>= 1.0.0)
rack (>= 0.9.0)
Expand Down Expand Up @@ -133,7 +133,7 @@ GEM
bullet (6.1.0)
activesupport (>= 3.0.0)
uniform_notifier (~> 1.11)
byebug (11.1.2)
byebug (11.1.3)
cancancan (2.3.0)
capybara (3.32.1)
addressable
Expand Down Expand Up @@ -167,7 +167,7 @@ GEM
crack (0.4.3)
safe_yaml (~> 1.0.0)
crass (1.0.6)
crawler_detect (0.1.11)
crawler_detect (0.1.12)
csl (1.5.1)
namae (~> 1.0)
csl-styles (1.0.1.10)
Expand Down Expand Up @@ -237,12 +237,12 @@ GEM
flipper (~> 0.17.2)
gender_detector (0.1.2)
unicode_utils (>= 1.3.0)
git (1.6.0)
git (1.7.0)
rchardet (~> 1.8)
globalid (0.4.2)
activesupport (>= 4.2.0)
google-protobuf (3.10.0.rc.1)
graphql (1.9.19)
graphql (1.10.8)
graphql-batch (0.4.2)
graphql (>= 1.3, < 2)
promise.rb (~> 0.7.2)
Expand Down Expand Up @@ -333,7 +333,7 @@ GEM
method_source (1.0.0)
mime-types (3.3.1)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.1009)
mime-types-data (3.2020.0425)
mimemagic (0.3.4)
mini_magick (4.10.1)
mini_mime (1.0.2)
Expand All @@ -352,7 +352,7 @@ GEM
mini_portile2 (~> 2.4.0)
oj (3.10.6)
oj_mimic_json (1.0.1)
optimist (3.0.0)
optimist (3.0.1)
pandoc-ruby (2.1.4)
parallel (1.19.1)
parser (2.7.1.1)
Expand Down Expand Up @@ -482,6 +482,8 @@ GEM
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
safe_yaml (1.0.5)
seedbank (0.5.0)
rake (>= 10.0)
sentry-raven (2.13.0)
faraday (>= 0.7.6, < 1.0)
shoryuken (4.0.3)
Expand Down Expand Up @@ -562,7 +564,7 @@ PLATFORMS
DEPENDENCIES
aasm (~> 5.0, >= 5.0.1)
active_model_serializers (~> 0.10.0)
apollo-federation (~> 1.0)
apollo-federation (~> 1.0, >= 1.0.4)
audited (~> 4.8)
aws-sdk-s3
aws-sdk-sqs (~> 1.3)
Expand Down Expand Up @@ -603,7 +605,7 @@ DEPENDENCIES
gender_detector (~> 0.1.2)
git (~> 1.5)
google-protobuf (= 3.10.0.rc.1)
graphql (~> 1.9.16)
graphql (~> 1.10, >= 1.10.8)
graphql-batch (~> 0.4.1)
graphql-cache (~> 0.6.0)
graphql-errors (~> 0.4.0)
Expand Down Expand Up @@ -637,6 +639,7 @@ DEPENDENCIES
rubocop (~> 0.77.0)
rubocop-performance (~> 1.5, >= 1.5.1)
rubocop-rails (~> 2.4)
seedbank
sentry-raven (~> 2.9)
shoryuken (~> 4.0)
shoulda-matchers (~> 4.1, >= 4.1.2)
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/lupo_schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class LupoSchema < GraphQL::Schema
max_depth 10

# mutation(Types::MutationType)
query(Types::QueryType)
query(QueryType)

use GraphQL::Batch
use GraphQL::Cache
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/address_type.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class Types::AddressType < Types::BaseObject
class AddressType < BaseObject
description "Information about addresses"

field :type, String, null: true, description: "The type."
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/affiliation_type.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class Types::AffiliationType < Types::BaseObject
class AffiliationType < BaseObject
description "Information about affiliations"

field :id, ID, null: true, description: "Affiliation ROR identifier"
Expand Down
12 changes: 6 additions & 6 deletions app/graphql/types/audiovisual_connection_type.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

class Types::AudiovisualConnectionType < Types::BaseConnection
edge_type(Types::AudiovisualEdgeType)
class AudiovisualConnectionType < BaseConnection
edge_type(AudiovisualEdgeType)
field_class GraphQL::Cache::Field

field :total_count, Integer, null: false, cache: true
field :years, [Types::FacetType], null: true, cache: true
field :registration_agencies, [Types::FacetType], null: true, cache: true
field :repositories, [Types::FacetType], null: true, cache: true
field :affiliations, [Types::FacetType], null: true, cache: true
field :years, [FacetType], null: true, cache: true
field :registration_agencies, [FacetType], null: true, cache: true
field :repositories, [FacetType], null: true, cache: true
field :affiliations, [FacetType], null: true, cache: true

def total_count
args = prepare_args(object.arguments)
Expand Down
4 changes: 2 additions & 2 deletions app/graphql/types/audiovisual_edge_type.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Types::AudiovisualEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(Types::AudiovisualType)
class AudiovisualEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(AudiovisualType)
end
4 changes: 2 additions & 2 deletions app/graphql/types/audiovisual_type.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Types::AudiovisualType < Types::BaseObject
implements Types::DoiItem
class AudiovisualType < BaseObject
implements DoiItem
end
2 changes: 1 addition & 1 deletion app/graphql/types/base_connection.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# frozen_string_literal: true

class Types::BaseConnection < GraphQL::Types::Relay::BaseConnection
class BaseConnection < GraphQL::Types::Relay::BaseConnection
def doi_from_url(url)
if /\A(?:(http|https):\/\/(dx\.)?(doi.org|handle.test.datacite.org)\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match?(url)
uri = Addressable::URI.parse(url)
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/base_enum.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

class Types::BaseEnum < GraphQL::Schema::Enum
class BaseEnum < GraphQL::Schema::Enum
end
2 changes: 1 addition & 1 deletion app/graphql/types/base_field.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'apollo-federation'

class Types::BaseField < GraphQL::Schema::Field
class BaseField < GraphQL::Schema::Field
include ApolloFederation::Field

#field_class GraphQL::Cache::Field
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/base_input_object.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

class Types::BaseInputObject < GraphQL::Schema::InputObject
class BaseInputObject < GraphQL::Schema::InputObject
end
4 changes: 2 additions & 2 deletions app/graphql/types/base_interface.rb
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# frozen_string_literal: true

module Types::BaseInterface
module BaseInterface
include GraphQL::Schema::Interface
include ApolloFederation::Interface

field_class Types::BaseField
field_class BaseField
end
4 changes: 2 additions & 2 deletions app/graphql/types/base_object.rb
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# frozen_string_literal: true

class Types::BaseObject < GraphQL::Schema::Object
class BaseObject < GraphQL::Schema::Object
include ApolloFederation::Object

field_class Types::BaseField
field_class BaseField

def doi_from_url(url)
if /\A(?:(http|https):\/\/(dx\.)?(doi.org|handle.test.datacite.org)\/)?(doi:)?(10\.\d{4,5}\/.+)\z/.match?(url)
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/base_scalar.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

class Types::BaseScalar < GraphQL::Schema::Scalar
class BaseScalar < GraphQL::Schema::Scalar
end
2 changes: 1 addition & 1 deletion app/graphql/types/base_union.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# frozen_string_literal: true

class Types::BaseUnion < GraphQL::Schema::Union
class BaseUnion < GraphQL::Schema::Union
end
10 changes: 5 additions & 5 deletions app/graphql/types/book_chapter_connection_type.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

class Types::BookChapterConnectionType < Types::BaseConnection
class BookChapterConnectionType < BaseConnection
edge_type(BookChapterEdgeType)
field_class GraphQL::Cache::Field

field :total_count, Integer, null: false, cache: true
field :years, [Types::FacetType], null: true, cache: true
field :registration_agencies, [Types::FacetType], null: true, cache: true
field :repositories, [Types::FacetType], null: true, cache: true
field :affiliations, [Types::FacetType], null: true, cache: true
field :years, [FacetType], null: true, cache: true
field :registration_agencies, [FacetType], null: true, cache: true
field :repositories, [FacetType], null: true, cache: true
field :affiliations, [FacetType], null: true, cache: true

def total_count
args = prepare_args(object.arguments)
Expand Down
2 changes: 1 addition & 1 deletion app/graphql/types/book_chapter_edge_type.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Types::BookChapterEdgeType < GraphQL::Types::Relay::BaseEdge
class BookChapterEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(BookChapterType)
end
4 changes: 2 additions & 2 deletions app/graphql/types/book_chapter_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Types::BookChapterType < Types::BaseObject
implements Types::DoiItem
class BookChapterType < BaseObject
implements DoiItem

def type
"BookChapter"
Expand Down
10 changes: 5 additions & 5 deletions app/graphql/types/book_connection_type.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

class Types::BookConnectionType < Types::BaseConnection
class BookConnectionType < BaseConnection
edge_type(BookEdgeType)
field_class GraphQL::Cache::Field

field :total_count, Integer, null: false, cache: true
field :years, [Types::FacetType], null: true, cache: true
field :registration_agencies, [Types::FacetType], null: true, cache: true
field :repositories, [Types::FacetType], null: true, cache: true
field :affiliations, [Types::FacetType], null: true, cache: true
field :years, [FacetType], null: true, cache: true
field :registration_agencies, [FacetType], null: true, cache: true
field :repositories, [FacetType], null: true, cache: true
field :affiliations, [FacetType], null: true, cache: true

def total_count
args = prepare_args(object.arguments)
Expand Down
4 changes: 2 additions & 2 deletions app/graphql/types/book_edge_type.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Types::BookEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(Types::BookType)
class BookEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(BookType)
end
4 changes: 2 additions & 2 deletions app/graphql/types/book_type.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# frozen_string_literal: true

class Types::BookType < Types::BaseObject
implements Types::DoiItem
class BookType < BaseObject
implements DoiItem

def type
"Book"
Expand Down
10 changes: 5 additions & 5 deletions app/graphql/types/collection_connection_type.rb
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# frozen_string_literal: true

class Types::CollectionConnectionType < Types::BaseConnection
edge_type(Types::CollectionEdgeType)
class CollectionConnectionType < BaseConnection
edge_type(CollectionEdgeType)
field_class GraphQL::Cache::Field

field :total_count, Integer, null: false, cache: true
field :years, [Types::FacetType], null: true, cache: true
field :repositories, [Types::FacetType], null: true, cache: true
field :affiliations, [Types::FacetType], null: true, cache: true
field :years, [FacetType], null: true, cache: true
field :repositories, [FacetType], null: true, cache: true
field :affiliations, [FacetType], null: true, cache: true

def total_count
args = prepare_args(object.arguments)
Expand Down
4 changes: 2 additions & 2 deletions app/graphql/types/collection_edge_type.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Types::CollectionEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(Types::CollectionType)
class CollectionEdgeType < GraphQL::Types::Relay::BaseEdge
node_type(CollectionType)
end
4 changes: 2 additions & 2 deletions app/graphql/types/collection_type.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

class Types::CollectionType < Types::BaseObject
implements Types::DoiItem
class CollectionType < BaseObject
implements DoiItem
end
12 changes: 6 additions & 6 deletions app/graphql/types/conference_paper_connection_type.rb
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# frozen_string_literal: true

class Types::ConferencePaperConnectionType < Types::BaseConnection
edge_type(Types::ConferencePaperEdgeType)
class ConferencePaperConnectionType < BaseConnection
edge_type(ConferencePaperEdgeType)
field_class GraphQL::Cache::Field

field :total_count, Integer, null: false, cache: true
field :years, [Types::FacetType], null: true, cache: true
field :registration_agencies, [Types::FacetType], null: true, cache: true
field :repositories, [Types::FacetType], null: true, cache: true
field :affiliations, [Types::FacetType], null: true, cache: true
field :years, [FacetType], null: true, cache: true
field :registration_agencies, [FacetType], null: true, cache: true
field :repositories, [FacetType], null: true, cache: true
field :affiliations, [FacetType], null: true, cache: true

def total_count
args = prepare_args(object.arguments)
Expand Down
Loading

0 comments on commit 3139b56

Please sign in to comment.