Skip to content

Commit

Permalink
add support for apollo federation. datacite/volpino#78
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Fenner committed Oct 3, 2019
1 parent 24996a8 commit 21f68cf
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 27 deletions.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ gem 'graphql-errors', '~> 0.3.0'
gem 'graphql-batch', '~> 0.4.0'
gem 'batch-loader', '~> 1.4', '>= 1.4.1'
gem 'graphql-cache', '~> 0.6.0', git: "https://github.com/stackshareio/graphql-cache"
gem 'apollo-federation', '~> 0.4.0'
# gem 'ddtrace', '~> 0.23.3'

group :development, :test do
Expand Down
57 changes: 31 additions & 26 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ GIT
GEM
remote: https://rubygems.org/
specs:
aasm (5.0.5)
aasm (5.0.6)
concurrent-ruby (~> 1.0)
actioncable (5.2.3)
actionpack (= 5.2.3)
Expand Down Expand Up @@ -56,28 +56,31 @@ GEM
i18n (>= 0.7, < 2)
minitest (~> 5.1)
tzinfo (~> 1.1)
addressable (2.6.0)
public_suffix (>= 2.0.2, < 4.0)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
ansi (1.5.0)
apollo-federation (0.4.0)
google-protobuf
graphql
arel (9.0.0)
ast (2.4.0)
audited (4.9.0)
activerecord (>= 4.2, < 6.1)
aws-eventstream (1.0.3)
aws-partitions (1.207.0)
aws-sdk-core (3.65.0)
aws-partitions (1.220.0)
aws-sdk-core (3.68.0)
aws-eventstream (~> 1.0, >= 1.0.2)
aws-partitions (~> 1.0)
aws-sigv4 (~> 1.1)
jmespath (~> 1.0)
aws-sdk-kms (1.24.0)
aws-sdk-core (~> 3, >= 3.61.1)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.46.0)
aws-sdk-s3 (1.48.0)
aws-sdk-core (~> 3, >= 3.61.1)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.1)
aws-sdk-sqs (1.21.0)
aws-sdk-sqs (1.22.0)
aws-sdk-core (~> 3, >= 3.61.1)
aws-sigv4 (~> 1.1)
aws-sigv4 (1.1.0)
Expand Down Expand Up @@ -129,12 +132,12 @@ GEM
rdf-rdfxml (~> 2.0)
rdf-turtle (~> 2.2)
thor (~> 0.19)
bootsnap (1.4.4)
bootsnap (1.4.5)
msgpack (~> 1.0)
builder (3.2.3)
byebug (11.0.1)
cancancan (2.3.0)
capybara (3.28.0)
capybara (3.29.0)
addressable
mini_mime (>= 0.1.3)
nokogiri (~> 1.8)
Expand Down Expand Up @@ -186,8 +189,8 @@ GEM
ebnf (1.1.3)
rdf (~> 3.0)
sxp (~> 1.0)
edtf (3.0.4)
activesupport (>= 3.0, < 6.0)
edtf (3.0.5)
activesupport (>= 3.0, < 7.0)
elasticsearch (6.8.0)
elasticsearch-api (= 6.8.0)
elasticsearch-transport (= 6.8.0)
Expand All @@ -206,7 +209,7 @@ GEM
multi_json
equivalent-xml (0.6.0)
nokogiri (>= 1.4.3)
erubi (1.8.0)
erubi (1.9.0)
excon (0.62.0)
facets (3.1.0)
factory_bot (4.11.1)
Expand All @@ -222,9 +225,9 @@ GEM
faraday
faraday_middleware (0.12.2)
faraday (>= 0.7.4, < 1.0)
faraday_middleware-aws-sigv4 (0.2.4)
faraday_middleware-aws-sigv4 (0.2.5)
aws-sigv4 (~> 1.0)
faraday (>= 0.9)
faraday (>= 0.9, < 0.15)
fast_jsonapi (1.5)
activesupport (>= 4.2)
ffi (1.11.1)
Expand All @@ -237,7 +240,8 @@ GEM
git (1.5.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
graphql (1.9.10)
google-protobuf (3.9.2)
graphql (1.9.12)
graphql-batch (0.4.1)
graphql (>= 1.3, < 2)
promise.rb (~> 0.7.2)
Expand Down Expand Up @@ -298,7 +302,7 @@ GEM
logstash-event (1.2.02)
logstash-logger (0.26.1)
logstash-event (~> 1.2)
loofah (2.2.3)
loofah (2.3.0)
crass (~> 1.0.2)
nokogiri (>= 1.5.9)
mail (2.7.1)
Expand All @@ -319,14 +323,14 @@ GEM
nokogiri (~> 1.8.1)
oj (>= 2.8.3)
method_source (0.9.2)
mime-types (3.2.2)
mime-types (3.3)
mime-types-data (~> 3.2015)
mime-types-data (3.2019.0331)
mime-types-data (3.2019.0904)
mimemagic (0.3.3)
mini_magick (4.9.5)
mini_mime (1.0.2)
mini_portile2 (2.3.0)
minitest (5.11.3)
minitest (5.12.2)
money (6.13.4)
i18n (>= 0.6.4, <= 2)
msgpack (1.3.1)
Expand All @@ -335,14 +339,14 @@ GEM
mysql2 (0.4.10)
namae (1.0.1)
netrc (0.11.0)
nio4r (2.5.0)
nio4r (2.5.2)
nokogiri (1.8.5)
mini_portile2 (~> 2.3.0)
oj (2.18.5)
oj_mimic_json (1.0.1)
pandoc-ruby (2.0.2)
parallel (1.17.0)
parser (2.6.3.0)
parser (2.6.4.1)
ast (~> 2.4.0)
postrank-uri (1.0.24)
addressable (>= 2.4.0)
Expand Down Expand Up @@ -461,15 +465,15 @@ GEM
ruby-progressbar (1.10.1)
ruby_dep (1.5.0)
safe_yaml (1.0.5)
sentry-raven (2.11.0)
sentry-raven (2.11.3)
faraday (>= 0.7.6, < 1.0)
shoryuken (4.0.3)
aws-sdk-core (>= 2)
concurrent-ruby
thor
shoulda-matchers (3.1.3)
activesupport (>= 4.0.0)
simple_command (0.0.9)
simple_command (0.1.0)
simplecov (0.13.0)
docile (~> 1.1.0)
json (>= 1.8, < 3)
Expand Down Expand Up @@ -499,10 +503,10 @@ GEM
sxp (1.0.2)
rdf (~> 3.0)
sysrandom (1.0.5)
temple (0.8.1)
temple (0.8.2)
thor (0.20.3)
thread_safe (0.3.6)
tilt (2.0.9)
tilt (2.0.10)
trollop (2.9.9)
turnout (2.5.0)
i18n (>= 0.7, < 2)
Expand All @@ -517,7 +521,7 @@ GEM
unicode-display_width (1.5.0)
unicode_utils (1.4.0)
vcr (3.0.3)
webmock (3.7.0)
webmock (3.7.6)
addressable (>= 2.3.6)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
Expand All @@ -533,6 +537,7 @@ PLATFORMS
DEPENDENCIES
aasm (~> 5.0, >= 5.0.1)
active_model_serializers (~> 0.10.0)
apollo-federation (~> 0.4.0)
audited (~> 4.8)
aws-sdk-s3
aws-sdk-sqs (~> 1.3)
Expand Down
2 changes: 2 additions & 0 deletions app/graphql/lupo_schema.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# frozen_string_literal: true

class LupoSchema < GraphQL::Schema
include ApolloFederation::Schema

# use(GraphQL::Tracing::DataDogTracing, analytics_enabled: Rails.env.production?)

default_max_page_size 250
Expand Down
9 changes: 9 additions & 0 deletions app/graphql/types/base_field.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# frozen_string_literal: true

require 'apollo-federation'

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

#field_class GraphQL::Cache::Field
end
4 changes: 3 additions & 1 deletion app/graphql/types/base_object.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# frozen_string_literal: true

class BaseObject < GraphQL::Schema::Object
field_class GraphQL::Cache::Field
include ApolloFederation::Object

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

0 comments on commit 21f68cf

Please sign in to comment.