1.1.7 • Published 2 years ago

prompt-json-schema v1.1.7

Weekly downloads
-
License
ISC
Repository
github
Last release
2 years ago

prompt json schema

Contributing

N|prompt-json-schema

demo

N|demo-terminal

Installation

Using npm:

$ npm i prompt-json-schema

Note: add --save if you are using npm < 5.0.0

In Node.js:

// Load the full build.
const promptSchema = require("prompt-json-schema");
// initialize schema
const schema = {
  title: "Product",
  description: "A product from Acme's catalog",
  type: "object",
  properties: {
    productId: {
      description: "The unique identifier for a product",
      type: "integer",
    },
    productName: {
      description: "Name of the product",
      type: "string",
    },
    price: {
      description: "The price of the product",
      type: "number",
      exclusiveMinimum: 0,
    },
    tags: {
      description: "Tags for the product",
      type: "array",
      items: {
        type: "string",
      },
      minItems: 1,
      uniqueItems: true,
    },
  },
  required: ["productId"],
};
// async function establishment by the user call input
const result = await promptSchema(schema);
console.log("here result>>\n", result);

Why prompt-json-schema?

prompt-json-schema makes prompt in terminal or JavaScript shell (repl) easier by taking the hassle out of working json-schema objects, numbers, objects, strings, etc. prompt-json-schema modular methods are great for:

  • CLI
  • Manipulating & testing validations on json schema's data structures
  • Creating composite data objects

fix

//TODO fix shell usage

$ npm run build
$ chmod 777 ./dist/prompt-json-schema.js
$ ./dist/prompt-json-schema.js
1.1.1

2 years ago

1.1.0

2 years ago

1.1.7

2 years ago

1.1.6

2 years ago

1.1.5

2 years ago

1.1.4

2 years ago

1.1.3

2 years ago

1.1.2

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago