Skip to content

Commit d31913b

Browse files
committed
ow.obj.schemaGenerator: adding requiredArray
1 parent 369a393 commit d31913b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

js/owrap.obj.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2622,17 +2622,19 @@ OpenWrap.obj.prototype.schemaValidate = function(aSchema, aData, aErrorOptions)
26222622

26232623
/**
26242624
* <odoc>
2625-
* <key>ow.obj.schemaGenerator(aJson, aId) : Map</key>
2625+
* <key>ow.obj.schemaGenerator(aJson, aId, aRequiredArray) : Map</key>
26262626
* Given aJson object it tries to return a generated base json-schema (http://json-schema.org/understanding-json-schema/index.html)
26272627
* with an optional aId.
26282628
* </odoc>
26292629
*/
2630-
OpenWrap.obj.prototype.schemaGenerator = function(aJson, aId) {
2631-
aId = _$(aId, "id").isString().default("https://example.com/schema.json");
2630+
OpenWrap.obj.prototype.schemaGenerator = function(aJson, aId, aRequired) {
2631+
aId = _$(aId, "id").isString().default("https://example.com/schema.json");
2632+
aRequired = _$(aRequired, "required").isArray().default([]);
2633+
26322634
var r = {
26332635
"$id": aId,
26342636
"$schema": "http://json-schema.org/draft-07/schema#",
2635-
"required": []
2637+
"required": aRequired
26362638
};
26372639

26382640
var fn = function(j) {

0 commit comments

Comments
 (0)