📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

object-to-schema

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object-to-schema

> Convert JS Object to leaf api schema

1.4.0
Source
npm
Version published
Weekly downloads
4
-50%
Maintainers
1
Weekly downloads
 
Created
Source

object-to-schema

Convert JS Object to leaf api schema

Installation

$ npm i object-to-schema -S

Usage

const ots = require('object-to-schema');

const obj = {
  id: 100,
  owner: {
    show: true,
    login: 'japsu',
  },
  name: 'Tom',
  books: [
    {
      name: 'Hackers and Painters',
      author: 'Paul Graham',
    },
  ],
};

const jsonSchema = ots.json(obj);
const apiSchema = ots.api(obj);

console.log(JSON.stringify(jsonSchema, null, 2));

Keywords

object-to-schema

FAQs

Package last updated on 29 Dec 2017

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