Netherworld's Pretend Minibar

    jsonschema-avro

    1.6.0 • Public • Published

    jsonschema-avro

    npm Build Status

    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.

    Test

    npm test
    

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

    ONLY=optional npm test
    

    TODO

    • Handle anyOf and allOf.

    Install

    npm i jsonschema-avro

    DownloadsWeekly Downloads

    256

    Version

    1.6.0

    License

    MIT

    Unpacked Size

    16 kB

    Total Files

    31

    Last publish

    Collaborators

    • avatar