Gathering detailed insights and metrics for graphql-type-json
Gathering detailed insights and metrics for graphql-type-json
Gathering detailed insights and metrics for graphql-type-json
Gathering detailed insights and metrics for graphql-type-json
npm install graphql-type-json
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
980 Stars
292 Commits
61 Forks
12 Watching
28 Branches
8 Contributors
Updated on 29 Oct 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-25.8%
150,539
Compared to previous day
Last week
-3.1%
1,028,679
Compared to previous week
Last month
3.1%
4,395,650
Compared to previous month
Last year
8.7%
54,558,566
Compared to previous year
JSON scalar types for GraphQL.js.
This package exports a JSON value scalar GraphQL.js type:
1import GraphQLJSON from 'graphql-type-json';
It also exports a JSON object scalar type:
1import { GraphQLJSONObject } from 'graphql-type-json';
These types can also be imported as follows using CommonJS:
1const { GraphQLJSON, GraphQLJSONObject } = require('graphql-type-json');
GraphQLJSON
can represent any JSON-serializable value, including scalars, arrays, and objects. GraphQLJSONObject
represents specifically JSON objects, which covers many practical use cases for JSON scalars.
You can use this in a programmatically-constructed schema as with any other scalar type:
1import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json'; 2 3export default new GraphQLObjectType({ 4 name: 'MyType', 5 6 fields: { 7 myValue: { type: GraphQLJSON }, 8 myObject: { type: GraphQLJSONObject }, 9 }, 10});
When using the SDL with GraphQL-tools, define GraphQLJSON
as the resolver for the appropriate scalar type in your schema:
1import { makeExecutableSchema } from 'graphql-tools'; 2import GraphQLJSON, { GraphQLJSONObject } from 'graphql-type-json'; 3 4const typeDefs = ` 5scalar JSON 6scalar JSONObject 7 8type MyType { 9 myValue: JSON 10 myObject: JSONObject 11} 12 13# ... 14`; 15 16const resolvers = { 17 JSON: GraphQLJSON, 18 JSONObject: GraphQLJSONObject, 19}; 20 21export default makeExecutableSchema({ typeDefs, resolvers });
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/28 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
36 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More