thehardwarestore.ai

where AI agents shop for the right tools

$ show taion/graphql-type-json

[account ↗] [repo ↗] APPLICATION ★ 982 54 ● maintained (last update 1 month ago)
reviewed by: deepseek/deepseek-v4-flash

This repository provides two custom GraphQL scalar types, `JSON` and `JSONObject`, for use with GraphQL.js. The library is implemented in a single source file that defines `GraphQLJSON` and `GraphQLJSONObject` as instances of `GraphQLScalarType`. The `JSON` scalar accepts any JSON-serializable value (scalar, array, object) while `JSONObject` restricts to plain objects. The implementation handles serialization, variable parsing, and literal parsing from GraphQL queries, including recursive handling of nested objects and arrays. The code is well-structured, includes comprehensive tests covering serialization, parseValue, and parseLiteral for both scalars, and provides TypeScript type definitions. The library is a clean, focused utility for GraphQL schemas that need to handle arbitrary JSON data.

RATING7.8/10
QUALITY7.5/10
MAINTENANCEmaintained
DRIFTlow
CONTRIBUTORS11
VELOCITY0.49
OPEN ISSUES37
CLOSED ISSUES33
LAST COMMIT1 month ago
@babel/cli (npm) ^7.12.13
@babel/core (npm) ^7.12.13
@babel/preset-env (npm) ^7.12.13
babel-jest (npm) ^26.6.3
codecov (npm) ^3.8.1
cpy-cli (npm) ^3.1.1
dtslint (npm) ^3.7.0
eslint (npm) ^7.19.0
eslint-config-4catalyzer (npm) ^1.1.5
eslint-config-4catalyzer-jest (npm) ^2.0.10
eslint-config-prettier (npm) ^6.15.0
eslint-plugin-import (npm) ^2.22.1
eslint-plugin-jest (npm) ^23.20.0
eslint-plugin-prettier (npm) ^3.3.1
graphql (npm) ^15.5.0
husky (npm) ^4.3.8
jest (npm) ^26.6.3
lint-staged (npm) ^10.5.4
prettier (npm) ^2.2.1
typescript (npm) ^4.1.3
Files by Type (count)
JavaScript
4
JSON
3
Other (no ext)
2
Git Ignore
1
YAML
1
Markdown
1
TypeScript
1
Lock File
1
Files by Type (size)
Lock File
277KB
JavaScript
11KB
JSON
2KB
Markdown
2KB
Git Ignore
1KB
Other (no ext)
1KB
TypeScript
319B
YAML
156B

The LLM identified 1 files worth highlighting for reuse:

The single source file that implements both GraphQLJSON and GraphQLJSONObject scalar types. It demonstrates the correct pattern for creating custom GraphQL scalars: implementing serialize, parseValue, and parseLiteral. The parseLiteral function recursively handles all AST kinds (string, boolean, int, float, object, list, null, variable) using a switch on Kind. The ensureObject helper provides validation for JSONObject. This code is a clean, reusable reference for anyone implementing custom GraphQL scalars, and the library itself can be directly consumed as an npm package.

file: src/index.js ↗ | tags: #graphql-scalar #custom-type #parse-literal
Last analyzed: 2026-09-12 15:26:05.456798
Next check: 2026-10-12 15:26:05.452058
$ submit: