GithubHelp home page GithubHelp logo

busterc / ndjson-generate-schema Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 0.0 82 KB

:information_source: Effortlessly convert your NDJSON data to a JSON Schema.

License: ISC License

JavaScript 100.00%
ndjson jsonld jsonlines jsonschema json-schema json-schema-generator

ndjson-generate-schema's Introduction

ndjson-generate-schema NPM version Build Status Dependency Status Coverage percentage

Effortlessly convert your NDJSON data to a JSON Schema.

Installation

$ npm install --save ndjson-generate-schema

# Or to use the CLI globally
$ npm install --global ndjson-generate-schema

Usage

Given an NDJSON file dogs.db:

{"id":1,"name":"Buddy","breed":"Boston Terrier"}
{"id":2,"name":"Charley"}

CLI

$ ndjson-generate-schema

  Effortlessly convert your NDJSON data to a JSON Schema.

  Usage

    $ ndjson-generate-schema <title> <file> [outfile]

  Inputs

    title     Required, Title of Schema
    file      Required, NDJSON file to read
    outfile   Optional, filename to write Schema out to

Module

const path = require('path');
const ndjsonGenerateSchema = require('ndjson-generate-schema');

ndjsonGenerateSchema('Dogs', path.resolve(__dirname, 'dogs.db')).then(
  schema => {
    console.log(schema);
    /*
    {
      "$schema": "http://json-schema.org/draft-04/schema#",
      "title": "Dogs Set",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "number"
          },
          "name": {
            "type": "string"
          },
          "breed": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "name"
        ],
        "title": "Dogs"
      }
    }
    */
  }
);

API

ndjsonGenerateSchema(title, file)

  • title

    • Required : String the title of the Schema
  • file

    • Required : String the NDJSON file to read

License

ISC © Buster Collings

ndjson-generate-schema's People

Contributors

busterc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.