Skip to content

Commit bdddb24

Browse files
committed
add feature #70
1 parent 797f906 commit bdddb24

File tree

3 files changed

+35
-11
lines changed

3 files changed

+35
-11
lines changed

dist/js/brutusin-json-forms.js

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,7 @@ if (typeof brutusin === "undefined") {
823823

824824
obj.getData = function () {
825825
function removeEmptiesAndNulls(object, s) {
826-
if (ss === null){
826+
if (ss === null) {
827827
ss = SCHEMA_ANY;
828828
}
829829
if (s.$ref) {
@@ -855,7 +855,7 @@ if (typeof brutusin === "undefined") {
855855
if (typeof s.additionalProperties === 'object') {
856856
ss = s.additionalProperties;
857857
}
858-
}
858+
}
859859
if (ss === null && s.hasOwnProperty("patternProperties")) {
860860
for (var p in s.patternProperties) {
861861
var r = RegExp(p);
@@ -1016,9 +1016,21 @@ if (typeof brutusin === "undefined") {
10161016
populateSchemaMap(childProp, schema.oneOf[i]);
10171017
}
10181018
} else if (schema.hasOwnProperty("$ref")) {
1019-
var newSchema = getDefinition(schema["$ref"]);
1020-
//console.log("$REF",name,newSchema);
1021-
populateSchemaMap(name, newSchema);
1019+
var refSchema = getDefinition(schema["$ref"]);
1020+
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
1021+
var clonedRefSchema = {};
1022+
for (var prop in refSchema) {
1023+
clonedRefSchema[prop] = refSchema[prop];
1024+
}
1025+
if (schema.hasOwnProperty("title")) {
1026+
clonedRefSchema.title = schema.title;
1027+
}
1028+
if (schema.hasOwnProperty("description")) {
1029+
clonedRefSchema.description = schema.description;
1030+
}
1031+
refSchema = clonedRefSchema;
1032+
}
1033+
populateSchemaMap(name, refSchema);
10221034

10231035
} else if (schema.type === "object") {
10241036
if (schema.properties) {

0 commit comments

Comments
 (0)