1

I have below graphql schema defined in a apollo server works as a subgraph behind Apollo federation router.

extend schema @link(url: "https://specs.apollo.dev/federation/v2.0", import: ["@key", "@shareable"])

  scalar DateTime @shareable

  type _Service {
    sdl: String
  }  

  # This "Book" type defines the queryable fields for every book in our data source.
  type Book {
    title: String
    author: String
    date: DateTime
  }

It has a custom scalar type DateTime. I marked it as @sharable in order to make this type visible in other subgraph. But when I try to launch this Apollo server I got below error:

GraphQLError: Directive "@shareable" may not be used on SCALAR.

It says @shareable is not shareable. How can I make a custom type available in other sub-graphs?

Joey Yi Zhao
  • 37,514
  • 71
  • 268
  • 523

0 Answers0