Socket
Socket
Sign inDemoInstall

graphql-type-uuid

Package Overview
Dependencies
1
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    graphql-type-uuid

UUID scalar type for GraphQL.js


Version published
Weekly downloads
4.8K
decreased by-10.02%
Maintainers
1
Install size
15.2 kB
Created
Weekly downloads
 

Changelog

Source

[0.2.0] - 2018-07-13

Changed

  • Calling .default after require('graphql-type-uuid') is no longer needed (nor supported).

Readme

Source

graphql-type-uuid npm

UUID scalar type for GraphQL.js.

Travis Codecov

Usage

This package exports a UUID scalar GraphQL.js type:

import GraphQLUUID from 'graphql-type-uuid';

Programmatically-constructed schemas

You can use this in a programmatically-constructed schema as with any other scalar type:

import { GraphQLObjectType } from 'graphql';
import GraphQLUUID from 'graphql-type-uuid';

export default new GraphQLObjectType({
  name: 'MyType',
  fields: {
    myField: { type: GraphQLUUID },
  },
});

SDL with graphql-tools

When using the SDL with graphql-tools, define GraphQLUUID as the resolver for the corresponding scalar type in your schema:

import { makeExecutableSchema } from 'graphql-tools';
import GraphQLUUID from 'graphql-type-uuid';

const typeDefs = `
scalar UUID

type MyType {
  myField: UUID
}
`;

const resolvers = {
  UUID: GraphQLUUID,
};

export default makeExecutableSchema({ typeDefs, resolvers });

If you happen to be looking for a JSON scalar GraphQL.js type, please check graphql-type-json, in which this project is heavily inspired.

Keywords

FAQs

Last updated on 13 Jul 2018

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc