Easily convert Joi schemas into GraphQL data types.
Lead Mainter: Samuel Joli
Installation
npm install --save joi2gql
graphql-js is listed as a peer dependency.
joi2gql
does not install it's own instance of graphql and instead requires parent module to provide it. This avoids any version collisions.
Example
const Joi = ;const Joi2GQL = ; const joiSchema = Joiobject; const GraphQLDataType = Joi2GQL;
Usage
const Server } = ;const graphqlHapi } = ; const Joi = ;const Joi2GQL = ; const port = '3000';const host = 'localhost';const server = ; server; const songSchema = Joiobject; const config = name: 'Song' args: id: Joi { return artist: 'Tycho' title : 'Awake' length: 443 ; }; const Song = Joi2GQL;const rootGQLSchema = query: song: Song ; server; serverstart { if err throw err; console;
API
See the detailed API reference.
Contributing
We love community and contributions! Please check out our guidelines before making any PRs.
Setting up for development
Install dependencies and run test.
npm install && npm test
GraphQL types not yet supported.
GraphQLInterfaceType
GraphQLUnionType