subgraph-mock 0.2.1

A standalone mock subgraph server designed to be placed behind a supergraph for testing.
Documentation
schema
  @link(url: "https://specs.apollo.dev/link/v1.0")
  @link(url: "https://specs.apollo.dev/join/v0.3", for: EXECUTION)
{
  query: Query
}

directive @join__enumValue(graph: join__Graph!) repeatable on ENUM_VALUE

directive @join__field(graph: join__Graph, requires: join__FieldSet, provides: join__FieldSet, type: String, external: Boolean, override: String, usedOverridden: Boolean) repeatable on FIELD_DEFINITION | INPUT_FIELD_DEFINITION

directive @join__graph(name: String!, url: String!) on ENUM_VALUE

directive @join__implements(graph: join__Graph!, interface: String!) repeatable on OBJECT | INTERFACE

directive @join__type(graph: join__Graph!, key: join__FieldSet, extension: Boolean! = false, resolvable: Boolean! = true, isInterfaceObject: Boolean! = false) repeatable on OBJECT | INTERFACE | UNION | ENUM | INPUT_OBJECT | SCALAR

directive @join__unionMember(graph: join__Graph!, member: String!) repeatable on UNION

directive @link(url: String, as: String, for: link__Purpose, import: [link__Import]) repeatable on SCHEMA

type Address
  @join__type(graph: USERS)
{
  streetAddress1: String!
  streetAddress2: String
  city: String!
  state: String!
  postCode: String!
  country: String!
}

scalar join__FieldSet

enum join__Graph {
  POSTS @join__graph(name: "posts", url: "http://localhost:4002/")
  USERS @join__graph(name: "users", url: "http://localhost:4001/")
}

scalar link__Import

enum link__Purpose {
  """
  `SECURITY` features provide metadata necessary to securely resolve fields.
  """
  SECURITY

  """
  `EXECUTION` features provide metadata necessary for operation execution.
  """
  EXECUTION
}

type Post
  @join__type(graph: POSTS, key: "id")
  @join__type(graph: USERS, key: "id")
{
  id: ID!
  title: String! @join__field(graph: POSTS)
  type: PostType! @join__field(graph: POSTS)
  content: String! @join__field(graph: POSTS) @join__field(graph: USERS, external: true)
  author: User! @join__field(graph: POSTS)
  featuredImage: String @join__field(graph: POSTS)
}

enum PostType
  @join__type(graph: POSTS)
{
  EPHEMERAL @join__enumValue(graph: POSTS)
  PERMANENT @join__enumValue(graph: POSTS)
}

type Query
  @join__type(graph: POSTS)
  @join__type(graph: USERS)
{
  posts: [Post!]! @join__field(graph: POSTS)
  post(id: ID!): Post! @join__field(graph: POSTS)
  user(id: ID!): User @join__field(graph: USERS)
  users: [User!]! @join__field(graph: USERS)
}

type User
  @join__type(graph: POSTS, key: "id")
  @join__type(graph: USERS, key: "id")
{
  id: ID!
  posts: [Post!]! @join__field(graph: POSTS) @join__field(graph: USERS, external: true)
  name: String! @join__field(graph: USERS)
  email: String! @join__field(graph: USERS)
  bio: String! @join__field(graph: USERS, requires: "posts {content}")
  address: Address! @join__field(graph: USERS)
}