Skip to content

v0.0.0 #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
5 of 6 tasks
ironhee opened this issue Feb 18, 2016 · 2 comments
Open
5 of 6 tasks

v0.0.0 #1

ironhee opened this issue Feb 18, 2016 · 2 comments
Labels

Comments

@ironhee
Copy link
Collaborator

ironhee commented Feb 18, 2016

Create nothinkdb implementation of graphql & relay.

Feature

Todo

  • implement nodeDefinitionsFromTables
  • implement getFieldsFromContext
  • implement getRelationsFromFields
  • implement connectionArgsToOffsets
  • implement getGraphQLFieldsFromTable
  • create Documentation.
@ironhee ironhee added the todo label Feb 18, 2016
@jeongsd
Copy link
Collaborator

jeongsd commented Feb 19, 2016

table.js support joi to graphqlscalartype for email, url, etc.

examples

joiToStringScalaType.js

import { GraphQLScalarType } from 'graphql';
import _ from 'lodash';
import Joi from 'Joi';

const joiToStringScalaType = (name, schema) => {
  return new GraphQLScalarType({
    name,
    serialize: value => {
      return value;
    },
    parseValue: value => {
      return value;
    },
    parseLiteral: ast => {
      if (ast.kind !== Kind.STRING) {
        throw new GraphQLError("Query error: Can only parse strings got a: " + ast.kind, [ast]);
      }

      let value;
      try {
        value = Joi.attempt(ast.value, schema);
      } catch (err) {
        throw new GraphQLError(err.message);
      }

      return value;
    }
  })
};

table.js

before

case 'string':
default:
  GraphQLType = GraphQLString;
  break;

after

case 'string':
default:
  GraphQLType = tests.length ? joiToStringScalaType(key, schema) :  GraphQLString;
  break;

commited at 6c4e31e

@ironhee
Copy link
Collaborator Author

ironhee commented Feb 19, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants