asbru 0.0.12

A Data-oriented service mesh generator
directive @serviceBackedQuery(
  service: String!,
  "Method used to connect to the service"
  methodName: String!,
) on QUERY

directive @fromNumber on OBJECT
directive @key(key: String!) on FIELD 
directive @rename(name: String!) on ENUM_VALUE

schema {
  query: Query
  mutation: Mutation
}

type Query {
  # "userById"
  # userById(id: ID!): Me!,
  petById(id: ID!): Pet
  @serviceBackedQuery(
    service: "pets",
    methodName: "petGetById"
  ),
  "me: Single-line comment"
  me: Me!
  active: Bool!
}

type Mutation {
  createFriendMutation(
    input: CreateFriendMutationInput!
  ): CreateFriendMutationPayload
}

type Subscription {
  badge: Int!
}

type Pet {
  id: ID! @fromNumber
  name: String!
  status: PetStatus
  photosUrls: [String] @key(key: "photoUrls")
}

enum PetStatus {
  AVAILABLE @rename(name: "available")
  STATUS @rename(name: "status")
  PENDING @rename(name: "pending")
  UNKNOWN @rename(name: "")
}


type CreateFriendMutationPayload {
  friend: Friend!
}

input CreateFriendMutationInput {
  userId: ID!
}

scalar Url

interface User @remote {
  id: ID!
  name: String!
}

type Friend implements User {
  "id: The friend ID"
  id: ID!
  name: String!
}

type FriendConnection {
  totalCount: Int!
  nodes: [Friend]!
}

type Me implements User {
  id: ID!
  name: String!
  rank: Float!
  email: String
  age: Int
  active: Bool
  # friends(first: Int): FriendConnection!
  notifications: [Notification]
  web: String
  # search(text: String!): [SearchResult]
}

type Notification {
  id: ID!
  title: String!
}

union SearchResult = Friend | Notification