schematized
Advanced tools
Comparing version 1.5.0 to 1.5.1
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.AdditionalProperties = void 0; | ||
const lodash_1 = __importDefault(require("lodash")); | ||
class AdditionalProperties { | ||
@@ -10,3 +14,3 @@ constructor() { | ||
addSchema(schema) { | ||
if (schema.additionalProperties) { | ||
if (!lodash_1.default.isNil(schema.additionalProperties)) { | ||
this.additionalProperties = schema.additionalProperties; | ||
@@ -13,0 +17,0 @@ } |
@@ -44,3 +44,3 @@ "use strict"; | ||
if (value) { | ||
if (this.properties[key]) { | ||
if (!(this.properties[key] instanceof schema_node_1.SchemaNode)) { | ||
this.properties[key] = new schema_node_1.SchemaNode(); | ||
@@ -47,0 +47,0 @@ } |
@@ -26,3 +26,3 @@ "use strict"; | ||
const required = new Set(schema.required); | ||
if (lodash_1.default.isNil(this.required)) { | ||
if (lodash_1.default.isNil(this.required) || this.required.size === 0) { | ||
this.required = required; | ||
@@ -29,0 +29,0 @@ } |
{ | ||
"name": "schematized", | ||
"description": "Turn objects into JSON schemas! The more examples you provide, the better your schema will be.", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"files": [ | ||
@@ -69,11 +69,17 @@ "dist/" | ||
"keywords": [ | ||
"json schema", | ||
"json", | ||
"schema", | ||
"builder", | ||
"object", | ||
"convert", | ||
"generate", | ||
"types", | ||
"type", | ||
"genson", | ||
"generator", | ||
"trainer", | ||
"node" | ||
"produce", | ||
"generic", | ||
"validation", | ||
"data", | ||
"datatypes", | ||
"build" | ||
] | ||
} |
# Schematized | ||
[![NPM](https://nodei.co/npm/schematized.png)](https://npmjs.org/package/schematized) | ||
[![npm version](https://badge.fury.io/js/schematized.svg)](https://badge.fury.io/js/schematized) | ||
![Build-Test-Publish](https://github.com/ryparker/JSON-Schema-Builder/workflows/Build-Test-Publish/badge.svg) | ||
@@ -11,4 +10,6 @@ [![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release) | ||
A Node port of the Python module Genson. | ||
A Node port of the Python module [GenSON](https://github.com/wolverdude/GenSON) but with more inferred constraints. | ||
**Example use case:** Generate JSON schemas using your API tests, then use the schemas to validate. To keep up to date, Write a test that compares your current schema with the generated schema. Then when your API changes, just update the tests with the newly generated schemas and move on with your day. | ||
--- | ||
@@ -22,3 +23,3 @@ | ||
- [📖 API](#-api) | ||
- [✅ Supported Schema Features](#-supported-schema-features) | ||
- [✅ Supported Schema Features](#?-supported-schema-features) | ||
- [Types](#types) | ||
@@ -25,0 +26,0 @@ - [Typeless](#typeless) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69551
979
279