{"id":25554,"library":"eth-json-schema-transpiler","title":"JSON Schema Transpiler (eth-json-schema-transpiler)","description":"A dev tool that converts JSON Schemas into type definitions for multiple languages including TypeScript, Go, Rust, and Python. Version 0.0.0-development is in early development with limited updates. It features automatic cycle detection, reference resolution, and deterministic title generation. Key differentiators: minimal dependencies, synchronous execution, and browser support via the web demo. The package generates one type alias per schema and includes documentation annotations.","status":"active","version":"0.0.0-development","language":"javascript","source_language":"en","source_url":"https://github.com/solimander/eth-json-schema-transpiler","tags":["javascript","typescript"],"install":[{"cmd":"npm install eth-json-schema-transpiler","lang":"bash","label":"npm"},{"cmd":"yarn add eth-json-schema-transpiler","lang":"bash","label":"yarn"},{"cmd":"pnpm add eth-json-schema-transpiler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Provides meta-schema validation and referencing used internally","package":"@json-schema-tools/meta-schema","optional":false},{"reason":"Handles JSON Schema $ref resolution and bundling","package":"json-schema-ref-parser","optional":false}],"imports":[{"note":"The package exports a default class, not named exports. CommonJS users should use require().default.","wrong":"import { JsonSchemaTranspiler } from 'eth-json-schema-transpiler'","symbol":"default","correct":"import JsonSchemaTranspiler from 'eth-json-schema-transpiler'"},{"note":"CommonJS require returns the module, so you need .default: const JsonSchemaTranspiler = require('eth-json-schema-transpiler').default","wrong":"const JsonSchemaTranspiler = require('eth-json-schema-transpiler')","symbol":"JsonSchemaTranspiler","correct":"import JsonSchemaTranspiler from 'eth-json-schema-transpiler'"},{"note":"toTypescript is an instance method, not static.","wrong":"JsonSchemaTranspiler.toTypescript(schema)","symbol":"toTypescript","correct":"const transpiler = new JsonSchemaTranspiler(schema); transpiler.toTypescript()"}],"quickstart":{"code":"import JsonSchemaTranspiler from 'eth-json-schema-transpiler';\n\nconst mySchema = {\n  title: 'Person',\n  type: 'object',\n  properties: {\n    name: { type: 'string' },\n    age: { type: 'integer' }\n  },\n  required: ['name']\n};\n\nconst transpiler = new JsonSchemaTranspiler(mySchema);\n\nconsole.log(transpiler.toTypescript());\n// Output: type Person = { name: string; age?: number; };","lang":"typescript","description":"Shows basic usage: import default, instantiate with schema, call toTypescript method."},"warnings":[{"fix":"Review generated types and adjust downstream code if needed.","message":"Upgrading from v0.0.1 to v0.0.2 changes default output format for Go and Rust outputs. TypeScript output now includes optional properties.","severity":"breaking","affected_versions":">=0.0.2"},{"fix":"Use toTypescript() instead of to('typescript').","message":"The .to('language') shorthand is deprecated in favor of explicit language methods (toTypescript, toGo, toRust, toPython).","severity":"deprecated","affected_versions":">=0.0.3"},{"fix":"Ensure your bundler (e.g., webpack) includes Node.js polyfills for path and url modules.","message":"JSON Schema $ref references may not be resolved in browser environments without bundler configuration for json-schema-ref-parser.","severity":"gotcha","affected_versions":"all"},{"fix":"Use exact lowercase names when calling .to(), or use the dedicated methods.","message":"The package is case-sensitive about language names: 'typescript', 'go', 'rust', 'python' are supported. 'TypeScript' or 'py' will throw an error.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use import JsonSchemaTranspiler from 'eth-json-schema-transpiler' (ESM) or const JsonSchemaTranspiler = require('eth-json-schema-transpiler').default (CJS)","cause":"Importing as named export instead of default, or using CommonJS without .default","error":"TypeError: JsonSchemaTranspiler is not a constructor"},{"fix":"Parse the JSON string first: JSON.parse(schemaString)","cause":"Passing a JSON string instead of a parsed object to the constructor","error":"Error: Invalid schema: schema must be an object"},{"fix":"Update to latest version. If using CommonJS, ensure you used .default.","cause":"Using an outdated version that does not have the .to() method, or importing incorrectly","error":"TypeError: transpiler.to is not a function"},{"fix":"Use one of: 'typescript', 'go', 'rust', 'python'","cause":"Providing an unsupported language name to .to()","error":"Error: Unsupported language 'python3'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}