Skip to content

Commit 2b71de5

Browse files
author
Omri Schwarz
committed
have additionalProperties DTRT when given a oneOf of internal references.
1 parent e75d7ad commit 2b71de5

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/js/brutusin-json-forms.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,9 @@ if (typeof brutusin === "undefined") {
353353
option.value = s.oneOf[i];
354354
appendChild(option, textNode, s);
355355
appendChild(input, option, s);
356-
/* if (value == undefined)
356+
if (value == undefined)
357357
continue;
358-
if (value.hasOwnProperty("type")) {
358+
/* if (value.hasOwnProperty("type")) {
359359
if (ss.hasOwnProperty("properties") ){
360360
if (ss.properties.hasOwnProperty("type")){
361361
var tryit = getSchema(ss.properties.type);
@@ -509,6 +509,7 @@ if (typeof brutusin === "undefined") {
509509
render(td1, td2, propId, current, pp, propInitialValue);
510510
}
511511
}
512+
// TODO: handle complex additionalProperties type definitions.
512513
if (s.additionalProperties) {
513514
var addPropS = getSchema(s.additionalProperties);
514515
var div = document.createElement("div");
@@ -818,7 +819,8 @@ if (typeof brutusin === "undefined") {
818819
if (schema.additionalProperties) {
819820
var childProp = name + "[*]";
820821
pseudoSchema.additionalProperties = childProp;
821-
if (schema.additionalProperties.hasOwnProperty("type")) {
822+
if (schema.additionalProperties.hasOwnProperty("type")||
823+
schema.additionalProperties.hasOwnProperty("oneOf")) {
822824
populateSchemaMap(childProp, schema.additionalProperties);
823825
} else {
824826
populateSchemaMap(childProp, SCHEMA_ANY);

0 commit comments

Comments
 (0)