New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

avsc-json-sample

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

avsc-json-sample

A librairy to generate predicable JSON sample from an avsc type

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

avsc json sample

This lib allows you to generate sample json documents from an Apache Avro schema.

To use it you have to wrap your schema in an avsc schema and call the function avscJsonSample() from this library

Sample usage

Install avsc and avsc-json-sample libs

npm i avsc avsc-json-sample

Then use it in your code

const avro = require("avsc");
const { avscJsonSample } = require("avsc-json-sample");

const avscType = avro.Type.forSchema({
  type: "record",
  fields: [
    { name: "kind", type: { type: "enum", symbols: ["CAT", "DOG"] } },
    { name: "name", type: "string" },
    { name: "age", type: "int" },
  ],
});

const jsonSample = avscJsonSample(avscType);
console.log(jsonSample); // { kind: 'CAT', name: 'string', age: 0 }

Have fun 🤩

Keywords

avro

FAQs

Package last updated on 23 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts