Quick Start
Install the package
npm install @json-schema-x-graphql/coreConvert JSON Schema → GraphQL SDL
import { convertJsonSchemaToGraphQL } from "@json-schema-x-graphql/core";
const sdl = convertJsonSchemaToGraphQL({
$schema: "http://json-schema.org/draft-07/schema#",
title: "Product",
type: "object",
properties: {
id: { type: "string" },
name: { type: "string" },
price: { type: "number" },
},
required: ["id", "name"],
});
console.log(sdl);
// type Product {
// id: String!
// name: String!
// price: Float
// }Convert GraphQL SDL → JSON Schema
import { convertGraphQLToJsonSchema } from "@json-schema-x-graphql/core";
const schema = convertGraphQLToJsonSchema(`
type Product {
id: String!
name: String!
price: Float
}
`);Use the interactive editor
Open the Live Editor → to author schemas visually with real-time bidirectional conversion and Apollo Federation support.
Next steps
- Installation options — Node.js, Rust, WASM, CLI
- x-graphql extensions — carry custom semantics through conversion
- Apollo Federation — generate Federation v2 subgraph SDL