xogroup / Joi2gql
Licence: other
Conversion of Joi schemas into GraphQL data types
Stars: ✭ 11
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Joi2gql
felicity
Javascript object constructors and sample data based on Joi schema.
Stars: ✭ 107 (+872.73%)
Mutual labels: schema, hapi, models
Graphql For Vscode
GraphQL syntax highlighting, linting, auto-complete, and more!
Stars: ✭ 265 (+2309.09%)
Mutual labels: graphql, schema
Joi
The most powerful data validation library for JS
Stars: ✭ 17,989 (+163436.36%)
Mutual labels: schema, hapi
Graphql Rover
🚀 GraphQL + Vue.js + D3.js schema viewer, powered by introspection.
Stars: ✭ 239 (+2072.73%)
Mutual labels: graphql, schema
godmt
Tool that can parse Go files into an abstract syntax tree and translate it to several programming languages.
Stars: ✭ 42 (+281.82%)
Mutual labels: schema, models
Graphback
Graphback - Out of the box GraphQL server and client
Stars: ✭ 323 (+2836.36%)
Mutual labels: graphql, schema
Plank
A tool for generating immutable model objects
Stars: ✭ 449 (+3981.82%)
Mutual labels: schema, models
Tuql
Automatically create a GraphQL server from a SQLite database or a SQL file
Stars: ✭ 526 (+4681.82%)
Mutual labels: graphql, schema
Coolqlcool
Nextjs server to query websites with GraphQL
Stars: ✭ 623 (+5563.64%)
Mutual labels: graphql, schema
Mongoke
Instant Graphql for MongoDb (active branch is golang, rewrite in process)
Stars: ✭ 203 (+1745.45%)
Mutual labels: graphql, schema
Graphql Code Generator
A tool for generating code based on a GraphQL schema and GraphQL operations (query/mutation/subscription), with flexible support for custom plugins.
Stars: ✭ 7,993 (+72563.64%)
Mutual labels: graphql, schema
vue-example
Vue.js example application (server-side rendering, router, vuex store, form validation, i18n & l10n)
Stars: ✭ 62 (+463.64%)
Mutual labels: schema, models
Graphql Parser
A graphql query language and schema definition language parser and formatter for rust
Stars: ✭ 203 (+1745.45%)
Mutual labels: graphql, schema
Babel Plugin Import Graphql
Enables import syntax for .graphql and .gql files
Stars: ✭ 284 (+2481.82%)
Mutual labels: graphql, schema
Countries
🌎 Public GraphQL API for information about countries
Stars: ✭ 156 (+1318.18%)
Mutual labels: graphql, schema
Graphql Toolkit
A set of utils for faster development of GraphQL tools
Stars: ✭ 169 (+1436.36%)
Mutual labels: graphql, schema
Typegql
Create GraphQL schema with TypeScript classes.
Stars: ✭ 415 (+3672.73%)
Mutual labels: graphql, schema
Type Graphql
Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
Stars: ✭ 6,864 (+62300%)
Mutual labels: graphql, schema
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 = require('joi');
const Joi2GQL = require('joi2gql');
const joiSchema = Joi.object().keys({
key1: Joi.string(),
key2: Joi.number().integer(),
key3: Joi.array().items(Joi.string()),
key4: Joi.object().keys({
subKey1: Joi.string(),
subKey2: Joi.number()
})
});
const GraphQLDataType = Joi2GQL.type(joiSchema);
Usage
const {
Server
} = require('hapi');
const {
graphqlHapi
} = require('apollo-server-hapi');
const Joi = require('joi');
const Joi2GQL = require('joi2gql');
const port = '3000';
const host = 'localhost';
const server = new Server();
server.connection({ port, host });
const songSchema = Joi.object().keys({
artist: Joi.string(),
title : Joi.string(),
length: Joi.number().integer(),
});
const config = {
name: 'Song',
args: {
id: Joi.number().integer()
},
resolve: (root, args) => {
return {
artist: 'Tycho',
title : 'Awake',
length: 4.43
};
}
};
const Song = Joi2GQL.type(songSchema, config);
const rootGQLSchema = {
query: {
song: Song
}
};
server.register({
register: graphqlHapi,
options : {
path : '/graphql',
graphqlOptions: {
schema: Joi2GQL.schema( rootGQLSchema )
}
}
});
server.start(() => {
if (err) {
throw new Error(err);
}
console.log(`Entering the matrix on port: ${server.info.port}`
});
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
Notes
Inspired by the joiql library
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].