Converts JSON Schema definitions into Avro schema definitions. Version 2.1.1 is the latest stable release. This library translates JSON Schema types and structures to Avro, supporting nested objects, arrays, enums, and primitives. It requires input schemas to be fully dereferenced (no external $ref). Lightweight, no runtime dependencies, synchronous conversion. Suitable for generating Avro schemas from existing JSON Schema definitions for use with Avro serialization (e.g., Apache Kafka, Hadoop).
npm install jsonschema-avroNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates conversion of a JSON Schema object to an Avro schema using the convert function.
Pre-process the schema with a tool like json-schema-ref-parser to resolve all $ref pointers before passing to convert().
Rewrite schemas using anyOf/allOf as union types via enums or other supported patterns, or use a more complete library.
Ensure enum values are all of the same type (Avro enums require strings).
Update to v2+ and use require('jsonschema-avro').convert().Update to v2+ or use: const convert = require('jsonschema-avro'); convert(input);Dereference the schema first using a library like @apidevtools/json-schema-ref-parser.
Restructure the schema to avoid these combinators, or use a different conversion library.
No dependency data recorded yet.