Skip to content

[Feature Request] Apollo Federation Support #297

Open
@nihalgonsalves

Description

@nihalgonsalves

Apollo Federation makes uses of some custom directives:

https://www.apollographql.com/docs/apollo-server/federation/federation-spec/

Version and Environment Details

Operation system: macOS

IDE name and version: IntelliJ IDEA Ultimate 2019.2

Plugin version: 2.2.0

Expected Behaviour

  1. The following directives should not produce errors:

    directive @external on FIELD_DEFINITION
    directive @requires(fields: _FieldSet!) on FIELD_DEFINITION
    directive @provides(fields: _FieldSet!) on FIELD_DEFINITION
    directive @key(fields: _FieldSet!) on OBJECT | INTERFACE
    directive @extends on OBJECT | INTERFACE

    (These directives must NOT be in the GraphQL file itself)

  2. An extend type TypeName should be allowed to exist without the base type, as the base type may be defined by another service

Actual Behaviour

  1. Error: Unknown directive "XXX"
  2. Error: The extension 'TypeName' type [@x:x] is missing its base underlying type

Steps to Reproduce / Link to Repo with Reproduction and Instructions

type InternalType @key(fields: "id") {
  id: ID!
  xyz: String!
  externalObject: ExternalType @requires(fields: "xyz") @provides(fields: "foo")
}

# In reality you need EITHER extend OR @extends
# depending on which server this schema is defined in
# (Apollo Server allows extend, graphql-java requires @extends)
extend type ExternalType @key(fields: "id") @extends {
  id: ID! @external
  foo: String! @external
  bar: String! @external
  baz: String!
}

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions