fluent-json-schema
Advanced tools
Comparing version 2.0.2 to 2.0.3
{ | ||
"name": "fluent-json-schema", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "JSON Schema fluent API", | ||
@@ -5,0 +5,0 @@ "main": "src/FluentJSONSchema.js", |
@@ -294,2 +294,3 @@ 'use strict' | ||
), | ||
required: schema.required.filter(p => properties.includes(p)), | ||
}, | ||
@@ -296,0 +297,0 @@ ...options, |
@@ -836,2 +836,30 @@ const { ObjectSchema } = require('./ObjectSchema') | ||
}) | ||
it('works correctly with required properties', () => { | ||
const base = S.object() | ||
.id('base') | ||
.title('base') | ||
.prop('foo', S.string().required()) | ||
.prop('bar', S.string()) | ||
.prop('baz', S.string().required()) | ||
.prop('qux', S.string()) | ||
const only = base.only(['foo', 'bar']) | ||
expect(only.valueOf()).toEqual({ | ||
$schema: 'http://json-schema.org/draft-07/schema#', | ||
$id: 'base', | ||
title: 'base', | ||
properties: { | ||
foo: { | ||
type: 'string', | ||
}, | ||
bar: { | ||
type: 'string', | ||
}, | ||
}, | ||
required: ['foo'], | ||
type: 'object', | ||
}) | ||
}) | ||
}) | ||
@@ -838,0 +866,0 @@ |
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
249340
6054