schematized
Advanced tools
Comparing version 1.7.2 to 1.8.0
@@ -0,1 +1,8 @@ | ||
# [1.8.0](https://github.com/ryparker/schematized/compare/v1.7.2...v1.8.0) (2020-08-07) | ||
### Features | ||
* **object strategy:** added support for disabling min/maxProperties on the object strategy ([0b07b2c](https://github.com/ryparker/schematized/commit/0b07b2c2b5bca90a35662822bead48dc954e1ad0)) | ||
## [1.7.2](https://github.com/ryparker/schematized/compare/v1.7.1...v1.7.2) (2020-08-06) | ||
@@ -2,0 +9,0 @@ |
@@ -33,4 +33,7 @@ "use strict"; | ||
let schema = super.toSchema(); | ||
schema = { ...schema, ...this.maximumStrategy.toSchema() }; | ||
schema = { ...schema, ...this.minimumStrategy.toSchema() }; | ||
schema = { | ||
...schema, | ||
...this.maximumStrategy.toSchema(), | ||
...this.minimumStrategy.toSchema() | ||
}; | ||
return schema; | ||
@@ -37,0 +40,0 @@ } |
@@ -5,3 +5,4 @@ import { SchemaNode } from '../../schema-node'; | ||
properties: Record<string, SchemaNode>; | ||
keywords: Set<string>; | ||
disabled: string[]; | ||
readonly keywords: Set<string>; | ||
private readonly PatternPropertiesStrategy; | ||
@@ -8,0 +9,0 @@ private readonly requiredStrategy; |
@@ -19,2 +19,3 @@ "use strict"; | ||
this.keywords = new Set(['type', 'properties']); | ||
this.disabled = []; | ||
this.properties = {}; | ||
@@ -45,4 +46,6 @@ this.PatternPropertiesStrategy = new pattern_properties_1.PatternProperties(); | ||
this.requiredStrategy.addObject(object); | ||
this.maxPropertiesStrategy.addObject(object); | ||
this.minPropertiesStrategy.addObject(object); | ||
if (!this.disabled.includes('maxProperties')) | ||
this.maxPropertiesStrategy.addObject(object); | ||
if (!this.disabled.includes('minProperties')) | ||
this.minPropertiesStrategy.addObject(object); | ||
} | ||
@@ -52,2 +55,4 @@ addSchema(schema) { | ||
const { properties } = schema; | ||
if (schema.disabled) | ||
this.disabled.push(...schema.disabled); | ||
if (properties) { | ||
@@ -75,9 +80,15 @@ for (const [key, value] of Object.entries(properties)) { | ||
} | ||
schema = { ...schema, ...this.PatternPropertiesStrategy.toSchema() }; | ||
schema = { ...schema, ...this.requiredStrategy.toSchema() }; | ||
schema = { ...schema, ...this.additionalPropertiesStrategy.toSchema() }; | ||
if (!schema.patternProperties) | ||
schema = { ...schema, ...this.maxPropertiesStrategy.toSchema() }; | ||
if (!schema.patternProperties) | ||
schema = { ...schema, ...this.minPropertiesStrategy.toSchema() }; | ||
schema = { | ||
...schema, | ||
...this.PatternPropertiesStrategy.toSchema(), | ||
...this.requiredStrategy.toSchema(), | ||
...this.additionalPropertiesStrategy.toSchema() | ||
}; | ||
if (!schema.patternProperties) { | ||
schema = { | ||
...schema, | ||
...this.maxPropertiesStrategy.toSchema(), | ||
...this.minPropertiesStrategy.toSchema() | ||
}; | ||
} | ||
return schema; | ||
@@ -84,0 +95,0 @@ } |
@@ -43,5 +43,8 @@ "use strict"; | ||
let schema = super.toSchema(); | ||
schema = { ...schema, ...this.maxLengthStrategy.toSchema() }; | ||
schema = { ...schema, ...this.minLengthStrategy.toSchema() }; | ||
schema = { ...schema, ...this.formatStrategy.toSchema() }; | ||
schema = { | ||
...schema, | ||
...this.maxLengthStrategy.toSchema(), | ||
...this.minLengthStrategy.toSchema(), | ||
...this.formatStrategy.toSchema() | ||
}; | ||
return schema; | ||
@@ -48,0 +51,0 @@ } |
{ | ||
"name": "schematized", | ||
"description": "Turn objects into JSON schemas! The more examples you provide, the better your schema will be.", | ||
"version": "1.7.2", | ||
"version": "1.8.0", | ||
"files": [ | ||
@@ -6,0 +6,0 @@ "dist" |
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
78915
1107