Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

elasticgraph-apollo

Package Overview
Dependencies
Maintainers
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

elasticgraph-apollo

  • 0.19.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
3
Created
Source

ElasticGraph::Apollo

Implements the Apollo Federation Subgraph Spec, allowing an ElasticGraph application to be plugged into an Apollo-powered GraphQL server as a subgraph.

Note: this library only supports the v2 Federation specification.

Usage

First, add elasticgraph-apollo to your Gemfile:

gem "elasticgraph-apollo"

Finally, update your ElasticGraph schema artifact rake tasks in your Rakefile so that ElasticGraph::GraphQL::Apollo::SchemaDefinition::APIExtension is passed as one of the extension_modules:

require "elastic_graph/schema_definition/rake_tasks"
require "elastic_graph/apollo/schema_definition/api_extension"

ElasticGraph::SchemaDefinition::RakeTasks.new(
  schema_element_name_form: :snake_case,
  index_document_sizes: true,
  path_to_schema: "config/schema.rb",
  schema_artifacts_directory: artifacts_dir,
  extension_modules: [ElasticGraph::Apollo::SchemaDefinition::APIExtension]
)

That's it!

Federation Version Support

This library supports multiple versions of Apollo federation. As of Jan. 2024, it supports:

  • v2.0
  • v2.3
  • v2.5
  • v2.6

By default, the newest version is targeted. If you need an older version (e.g. because your organization is running an older Apollo version), you can configure it in your schema definition with:

schema.target_apollo_federation_version "2.3"

Testing Notes

This project uses https://github.com/apollographql/apollo-federation-subgraph-compatibility to verify compatibility with Apollo. Things to note:

  • Run elasticgraph-apollo/script/test_compatibility to run the compatibility tests (the CI build runs this).
  • Run elasticgraph-apollo/script/boot_eg_apollo_implementation to boot the ElasticGraph compatibility test implementation (can be useful for debugging test_compatibility failures).
  • These scripts require some additional dependencies to be installed (such as docker, node, and npm).
  • To get that to pass locally on my Mac, I had to enable the Use Docker Compose V2 flag in Docker Desktop (under "Preferences -> General"). Without that checked, I got errors like this:
ERROR: for apollo-federation-subgraph-compatibility_router_1  Cannot start service router: OCI runtime create failed: container_linux.go:380: starting container process caused: process_linux.go:545: container init caused: rootfs_linux.go:76: mounting "/host_mnt/Users/myron/Development/sq-elasticgraph-ruby/elasticgraph-apollo/vendor/apollo-federation-subgraph-compatibility/supergraph.graphql" to rootfs at "/etc/config/supergraph.graphql" caused: mount through procfd: not a directory: unknown: Are you trying to mount a directory onto a file (or vice-versa)? Check if the specified host path exists and is the expected type

FAQs

Package last updated on 10 Dec 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc