npm

npm’s 2019 JavaScript ecosystem survey analysis is now available!Get your copy here »

avro-stitch

0.1.2 • Public • Published

avro-stitch

oclif Version Downloads/week License

Avro supports the abilities to reference other schemas, but confluent's schema registry doesn't allow you to reference one schema from another. To better support this use case, this tool will take a directory of .avsc files, each with a single record type in them, and a root entity, and will output one .avsc with everything in it. Avro has specific rules about defining a record type before using it, and this tool will ensure that those rules are respected.

Usage

Imagine the following:

a.avsc:

{
    "name": "A",
    "type": "record",
    "fields": [
        {
            "name": "b",
            "type": "B"
        }
    ]
}

b.avsc

{
    "name": "B",
    "type": "record",
    "fields": [
        {
            "name": "a",
            "type": "A"
        }
    ]
}

If you ran avro-stitch this way:

$ avro-stitch -d ~/dev/schemas -r A -o target.avsc

You'd get this output:

target.avsc

{
    "name": "A",
    "type": "record",
    "fields": [
        {
            "name": "b",
            "type": {
              "name": "B",
              "type": "record",
              "fields": [
                  {
                      "name": "a",
                      "type": "A"
                  }
              ]
          }
        }
    ]
}

target.avsc should be usable in confluent's schema registry.

Commands

Keywords

install

npm i avro-stitch

Downloadsweekly downloads

13

version

0.1.2

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability