2.1.1 • Published 2 months ago

jsonschema-avro v2.1.1

Weekly downloads
204
License
MIT
Repository
github
Last release
2 months ago

jsonschema-avro

npm Node.js CI

Converts JSON-schema definitions into Avro definitions.

Install

npm install jsonschema-avro

Consume

const jsonSchemaAvro = require('jsonschema-avro')

const inJson = {
  "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.

Develop

Avro schema documentation can be found here:

https://docs.oracle.com/cd/E26161_02/html/GettingStartedGuide/avroschemas.html

Testing

To run all tests:

npm test

To run a single test, using the name of the sample:

ONLY=optional npm test

CI uses the following script:

npm run ci

Please run this on your local machine to ensure CI will pass.

Code style

This project uses prettier, to format source files run:

npm run format

Please keep the integration tests to a single test per file for readability.

TODO

  • Handle anyOf and allOf.
2.1.1

2 months ago

1.8.1

1 year ago

2.1.0

12 months ago

2.0.0

1 year ago

1.8.0

1 year ago

1.7.0

1 year ago

1.6.1

2 years ago

1.6.0

5 years ago

1.5.0

5 years ago

1.4.0

5 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.0

7 years ago

1.0.0

7 years ago