Coder Social home page Coder Social logo

graphql-custom-types's Introduction

GraphQL Custom Types

npm version Build Status Dependency Status devDependencies Status peerDependencies Status

This is a collection of custom GraphQL types that I tend to reuse quite often so I packed them into a module.

Available Types

Let me give you an overview of the available types. If you need more detail about how to use them, check schema.js in the tests folder.

Scalar

The primitive types, aka everything that may be represented as a string. The ones with parameters you need to instantiate with new and pass according parameters, the others may be used as are.

  • GraphQLEmail
  • GraphQLURL
  • GraphQLDateTime
  • GraphQLLimitedString(min, max, alphabet)
  • GraphQLPassword(min, max, alphabet, complexity)
  • GraphQLUUID

complexity default options:

{
  alphaNumeric: false,
  mixedCase: false,
  specialChars: false
}

Installation

Most likely you already will have it, but do not forget to also install graphql, since it is required as peer dependency:

npm install graphql graphql-custom-types --save

Usage

import {
  GraphQLEmail,
  GraphQLURL,
  GraphQLDateTime,
  GraphQLLimitedString,
  GraphQLPassword,
  GraphQLUUID
} from 'graphql-custom-types';

And use it in your Schema as you would use any other type.

Development

Contributions are very welcome, please feel free to submit a type. If you do so make sure there are test cases in place.

Testing

The test suite may be invoked by running:

npm run test

graphql-custom-types's People

Contributors

aliatsis avatar glavin001 avatar jmcneese avatar steffenmllr avatar stylesuxx avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.