Skip to content

Commit

Permalink
add feature brutusin#70
Browse files Browse the repository at this point in the history
  • Loading branch information
idelvall committed Mar 20, 2017
1 parent 797f906 commit bdddb24
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 11 deletions.
22 changes: 17 additions & 5 deletions dist/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -823,7 +823,7 @@ if (typeof brutusin === "undefined") {

obj.getData = function () {
function removeEmptiesAndNulls(object, s) {
if (ss === null){
if (ss === null) {
ss = SCHEMA_ANY;
}
if (s.$ref) {
Expand Down Expand Up @@ -855,7 +855,7 @@ if (typeof brutusin === "undefined") {
if (typeof s.additionalProperties === 'object') {
ss = s.additionalProperties;
}
}
}
if (ss === null && s.hasOwnProperty("patternProperties")) {
for (var p in s.patternProperties) {
var r = RegExp(p);
Expand Down Expand Up @@ -1016,9 +1016,21 @@ if (typeof brutusin === "undefined") {
populateSchemaMap(childProp, schema.oneOf[i]);
}
} else if (schema.hasOwnProperty("$ref")) {
var newSchema = getDefinition(schema["$ref"]);
//console.log("$REF",name,newSchema);
populateSchemaMap(name, newSchema);
var refSchema = getDefinition(schema["$ref"]);
if (schema.hasOwnProperty("title") || schema.hasOwnProperty("description")) {
var clonedRefSchema = {};
for (var prop in refSchema) {
clonedRefSchema[prop] = refSchema[prop];
}
if (schema.hasOwnProperty("title")) {
clonedRefSchema.title = schema.title;
}
if (schema.hasOwnProperty("description")) {
clonedRefSchema.description = schema.description;
}
refSchema = clonedRefSchema;
}
populateSchemaMap(name, refSchema);

} else if (schema.type === "object") {
if (schema.properties) {
Expand Down
Loading

0 comments on commit bdddb24

Please sign in to comment.