subgraph-mock 0.2.1

A standalone mock subgraph server designed to be placed behind a supergraph for testing.
Documentation
schema {
  query: Query
}

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

directive @external on OBJECT | FIELD_DEFINITION

directive @requires(fields: FieldSet!) on FIELD_DEFINITION

directive @provides(fields: FieldSet!) on FIELD_DEFINITION

directive @key(fields: FieldSet!, resolvable: Boolean = true) repeatable on OBJECT | INTERFACE

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

directive @shareable on OBJECT | FIELD_DEFINITION

directive @inaccessible on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @tag(name: String!) repeatable on FIELD_DEFINITION | OBJECT | INTERFACE | UNION | ARGUMENT_DEFINITION | SCALAR | ENUM | ENUM_VALUE | INPUT_OBJECT | INPUT_FIELD_DEFINITION

directive @override(from: String!) on FIELD_DEFINITION

directive @composeDirective(name: String!) repeatable on SCHEMA

directive @interfaceObject on OBJECT

directive @authenticated on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM

directive @requiresScopes(scopes: [[federation__Scope!]!]!) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM

directive @policy(policies: [[federation__Policy!]!]!) on FIELD_DEFINITION | OBJECT | INTERFACE | SCALAR | ENUM

directive @context(name: String!) repeatable on INTERFACE | OBJECT | UNION

directive @fromContext(field: federation__ContextFieldValue) on ARGUMENT_DEFINITION

type Mutation {
  cart: CartMutations
}

type CartMutations {
  checkout(paymentMethodId: ID!): CheckoutResult
  addVariantToCart(variantId: ID!, quantity: Int = 1): ResultWithMessage
  removeVariantFromCart(variantId: ID!, quantity: Int = 1): ResultWithMessage
}

type ResultWithMessage {
  successful: Boolean
  message: String
}

type CheckoutResult {
  successful: Boolean
  orderID: ID
}

type User @key(fields: "id") {
  id: ID!
  cart: Cart
}

type Cart @key(fields: "userId") {
  userId: ID!
  items: [Variant]
  subtotal: Float @requires(fields: "items { price }")
}

type Variant @key(fields: "id", resolvable: false) {
  id: ID!
  price: Float! @external
}

union _Entity = User | Cart

type _Service {
  sdl: String!
}

scalar _Any

enum link__Purpose {
  SECURITY
  EXECUTION
}

scalar FieldSet

scalar link__Import

scalar federation__ContextFieldValue

scalar federation__Scope

scalar federation__Policy

type Query {
  _entities(representations: [_Any!]!): [_Entity]!
  _service: _Service!
}