{"id":48192,"library":"ipld-schema","title":"ipld-schema","description":"IPLD Schema DSL parser and CLI utilities for JavaScript. Provides parse, print, and validation functions for IPLD schema definitions. Current stable version is 3.0.3, with semiver releases as needed. Key differentiators: pure JS, no native dependencies, supports both programmatic use and CLI (validate and to-json commands), handles .ipldsch and .md files, and is part of the broader IPLD ecosystem. Ships TypeScript types.","status":"active","version":"3.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/rvagg/js-ipld-schema","tags":["javascript","typescript"],"install":[{"cmd":"npm install ipld-schema","lang":"bash","label":"npm"},{"cmd":"yarn add ipld-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add ipld-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package is ESM-only since v3. CommonJS require() will fail unless using a dynamic import.","wrong":"const { parse } = require('ipld-schema')","symbol":"parse","correct":"import { parse } from 'ipld-schema'"},{"note":"print is not re-exported from the main entry; it must be imported from the subpath 'ipld-schema/print.js'.","wrong":"import { print } from 'ipld-schema'","symbol":"print","correct":"import { print } from 'ipld-schema/print.js'"},{"note":"The function is named validate, not validateSchema. It validates schema DSL and returns an object with errors and warnings.","wrong":"import { validateSchema } from 'ipld-schema'","symbol":"validate","correct":"import { validate } from 'ipld-schema'"},{"note":"IPLDSchema is a TypeScript type export; use `import type` to avoid runtime inclusion.","wrong":"import { IPLDSchema } from 'ipld-schema'","symbol":"IPLDSchema (type)","correct":"import type { IPLDSchema } from 'ipld-schema'"}],"quickstart":{"code":"import { parse, validate } from 'ipld-schema';\n\nconst schemaDSL = `\n  type Person struct {\n    name String\n    age  Int\n  }\n`;\n\n// Parse schema DSL to AST\nconst schema = parse(schemaDSL);\nconsole.log(JSON.stringify(schema, null, 2));\n// Output includes field types and representation details\n\n// Validate schema DSL (check for errors)\nconst result = validate(schemaDSL);\nif (result.errors.length === 0) {\n  console.log('Schema is valid');\n} else {\n  console.error('Schema errors:', result.errors);\n}\n","lang":"typescript","description":"Parses an IPLD schema DSL string into an AST and validates it for correctness. Uses the parse and validate functions from the main module."},"warnings":[{"fix":"Use import syntax or dynamic import() instead of require().","message":"Package is ESM-only since v3. If using CommonJS (require), you must use dynamic import or upgrade to Node >= 16.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Change import path to 'ipld-schema/print.js'.","message":"The 'print' function is not exported from the main entry point; it must be imported from 'ipld-schema/print.js'. In older versions (v2), print was exported from the main entry.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Use npx ipld-schema or add a script to package.json.","message":"The CLI executable may not be available if installed as a dependency in a project without global install. Use npx ipld-schema or script with node_modules/.bin/ipld-schema.","severity":"gotcha","affected_versions":"*"},{"fix":"Use ipld-schema-validator package for data validation.","message":"Schema parsing does not perform recursive type resolution; it only parses the given DSL string. For validation of data against a schema, use ipld-schema-validator.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'3.0.3':27 'broader':62 'cli':9,45 'command':51 'current':23 'definit':22 'depend':39 'differenti':34 'dsl':6 'ecosystem':64 'file':56 'function':18 'handl':52 'ipld':2,4,20,63 'ipld-schema':1 'ipldsch':53 'javascript':12,68 'js':36 'json':50 'key':33 'md':55 'nativ':38 'need':32 'pars':14 'parser':7 'part':59 'print':15 'programmat':42 'provid':13 'pure':35 'releas':30 'schema':3,5,21 'semiv':29 'ship':65 'stabl':24 'support':40 'to-json':48 'type':67 'typescript':66,69 'use':43 'util':10 'valid':17,46 'version':25","created_at":"2026-06-07T16:55:22.294561+00:00","updated_at":"2026-06-07T16:55:22.294561+00:00","problems":[{"fix":"Use 'import { parse } from 'ipld-schema'' or 'const { parse } = await import('ipld-schema')'.","cause":"Using CommonJS require() on an ESM-only module (v3+).","error":"SyntaxError: Unexpected token 'export'"},{"fix":"Use 'import { print } from 'ipld-schema/print.js'' with the '.js' extension.","cause":"Missing .js extension in subpath import. Module resolution requires explicit extension for local imports.","error":"ERR_MODULE_NOT_FOUND: Cannot find module 'ipld-schema/print'"},{"fix":"Use 'import { parse } from 'ipld-schema'' instead of 'import parse from 'ipld-schema''.","cause":"Using default import instead of named import; the package has no default export.","error":"TypeError: parse is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/rvagg/js-ipld-schema#readme","github":"https://github.com/rvagg/js-ipld-schema","docs":null,"changelog":null,"pypi":null,"npm":"ipld-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}