• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

stylesuxx/graphql-custom-types: A collection of custom GraphQL types like Email, ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

stylesuxx/graphql-custom-types

开源软件地址(OpenSource Url):

https://github.com/stylesuxx/graphql-custom-types

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource 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



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap