json-schema-to-avro
TypeScript icon, indicating that this package has built-in type declarations

1.1.0 • Public • Published

json-schema-to-avro

npm Build Status

Converts JSON Schema definitions into Avro Schema definitions.

Install

npm install json-schema-to-avro

Consume

    const jsonSchemaAvro = require('json-schema-to-avro')
 
    const inJson = {
      "$id": "http://your-domain.com/schemas/your-schema.json"
      "description": "Example description",
      "type": "object",
      "properties": {
        "first_name": { "type": "string" },
        "address": {
          "type": "object",
          "properties": {
            "street_address": { "type": "string" }
          }
        }
      }
  }
 
  const avro = jsonSchemaAvro.convert(inJson)

Please ensure that the input JSON schema is dereferenced so that all external references have been resolved. json-schema-ref-parser can do this, prior to using this module.

Test

npm test

TODO

  • Handle anyOf and allOf.

Package Sidebar

Install

npm i json-schema-to-avro

Weekly Downloads

1,010

Version

1.1.0

License

MIT

Unpacked Size

150 kB

Total Files

17

Last publish

Collaborators

  • katsanva