Skip to content

convert tcomb types to secure, executable GraphQL schemas (WIP)

Notifications You must be signed in to change notification settings

dshimkoski/tcomb-graphql

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

An npm package will be created once the code is more stable, but for now you'll have to clone this repo and npm install

Basic Output source

node -r esm examples/basic

"""A beep noise"""
type Beep {
  beepiness: Int!
}

"""A boop noise"""
type Boop {
  boopiness: Int!
}

union BotNoise = Beep | Boop

type Message implements Textable {
  text: String!
}

type Mutation {
  """Send a message"""
  sendMessage(input: SendMessageInput!): SendMessageOutput!
}

type Query {
  """Fetch a message by ID"""
  message(id: ID!): Message

  """Fetch a list of bot noises"""
  botNoises: [BotNoise]!
}

"""sendMessage input"""
input SendMessageInput {
  text: String!
}

"""sendMessage response"""
type SendMessageOutput {
  sent: Boolean!
}

type Subscription {
  sendMessage(
    """optionally limit to particular User ID"""
    toId: ID
  ): Message!
}

interface Textable {
  text: String!
}

{"data":{"message":null,"botNoises":[{"boopiness":20}]}}

Secure Output source

node -r esm examples/secure

type Query {
  randomInt: RandomInt!
}

type RandomInt {
  int: Int!
}

{"errors":[{"message":"Permission denied","locations":[{"line":2,"column":3}],"path":["randomInt"]}],"data":null}
{"data":{"randomInt":{"int":25}}}

About

convert tcomb types to secure, executable GraphQL schemas (WIP)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published