Registry / devops / graphcool-json-schema

graphcool-json-schema

JSON →
library1.2.1jsnpmunverified

JSON schema and TypeScript definitions for graphcool.yml configuration files. Version 1.2.1 provides the canonical schema for the Graphcool framework's YAML config, enabling IDE autocompletion and validation. The schema is available as a hosted URL or bundled as a JSON file. The package includes TypeScript type definitions (GraphcoolDefinition) and exports the raw JSON schema. No longer maintained; the Graphcool framework has been superseded by Prisma.

npm install graphcool-json-schema
INSTALL
IMPORT
SIG · GRAPHCOOL-JSON-SCH
G
graphcool-json-schema
devopsjavascriptv1.2.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GraphcoolDefinition
import { GraphcoolDefinition } from 'graphcool-json-schema'
import GraphcoolDefinition from 'graphcool-json-schema'
TypeScript type is a named export, not a default export.
schema.json
import schema from 'graphcool-json-schema/dist/schema.json'
const schema = require('graphcool-json-schema/schema.json')
The JSON file is located under dist/; direct require without dist/ will fail.
schema.json (via require)
const schema = require('graphcool-json-schema/dist/schema.json')
CommonJS require works but must point to correct path.

Validates a graphcool.yml file against the schema using Ajv and outputs any validation errors.

// Validate graphcool.yml using the schema import { GraphcoolDefinition } from 'graphcool-json-schema'; import schema from 'graphcool-json-schema/dist/schema.json'; import Ajv from 'ajv'; import * as fs from 'fs'; import * as yaml from 'js-yaml'; const ajv = new Ajv(); const validate = ajv.compile(schema); const doc = yaml.load(fs.readFileSync('graphcool.yml', 'utf8')); const valid = validate(doc); if (!valid) { console.error('Validation errors:', validate.errors); } else { console.log('graphcool.yml is valid'); }
Debug
Known issues
deprecatedGraphcool framework is deprecated; Prisma is the successor.
fix
Migrate from Graphcool to Prisma (https://www.prisma.io/docs/guides/upgrade-guides/upgrade-from-graphcool)
affects: all
gotchaImporting JSON schema requires the /dist/ subpath.
fix
Use require('graphcool-json-schema/dist/schema.json') or import from 'graphcool-json-schema/dist/schema.json'
affects: >=1.0
breakingVersion 1.0.0 removed the direct export of the schema object.
fix
Update import path to include /dist/.
affects: >=1.0.0 <1.2.0
Errors
Common errors & fixes
Error: Cannot find module 'graphcool-json-schema/schema.json'
File is located in dist/ subfolder, not at package root.
fix
Use require('graphcool-json-schema/dist/schema.json')
Module parse failed: Unexpected token (1:0) You may need an appropriate loader to handle this file type.
Webpack or bundler tries to parse JSON as JavaScript.
fix
Use a JSON loader or configure webpack to handle .json files.
Upgrade
Version history
1.2.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
graphcool-json-schema — npm install graphcool-json-schema · libregistry