Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getData bugfix and onDependencyChanged feature #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
getData bugfix and onDependencyChanged feature
getData bombs out on an item list with empty elements.  I added several tests for "s" before additional tests on properties of "s".  This allows dependency changes to continue even on item lists with empty elements.

onDependencyChanged, I passed the source variable from the function input vars to the schema resolver.  This allows the resolver to calculate which of an item list is making the modification.
stutteringp0et authored Dec 1, 2017

Unverified

This user has not yet uploaded their public signing key.
commit 3fc3228c8f5bc55f266d8a1fa2681f126df72154
12 changes: 6 additions & 6 deletions src/js/brutusin-json-forms.js
Original file line number Diff line number Diff line change
@@ -834,7 +834,7 @@ if (typeof brutusin === "undefined") {
if (s === null) {
s = SCHEMA_ANY;
}
if (s.$ref) {
if (s && s.$ref) {
s = getDefinition(s.$ref);
}
if (object instanceof Array) {
@@ -856,15 +856,15 @@ if (typeof brutusin === "undefined") {
continue;
}
var ss = null;
if (s.hasOwnProperty("properties") && s.properties.hasOwnProperty(prop)) {
if (s && s.hasOwnProperty("properties") && s.properties.hasOwnProperty(prop)) {
ss = s.properties[prop];
}
if (ss === null && s.hasOwnProperty("additionalProperties")) {
if (ss === null && s && s.hasOwnProperty("additionalProperties")) {
if (typeof s.additionalProperties === 'object') {
ss = s.additionalProperties;
}
}
if (ss === null && s.hasOwnProperty("patternProperties")) {
if (ss === null && s && s.hasOwnProperty("patternProperties")) {
for (var p in s.patternProperties) {
var r = RegExp(p);
if (prop.search(r) !== -1) {
@@ -879,7 +879,7 @@ if (typeof brutusin === "undefined") {
nonEmpty = true;
}
}
if (nonEmpty || s.required) {
if (nonEmpty || s && s.required) {
return clone;
} else {
return null;
@@ -1346,7 +1346,7 @@ if (typeof brutusin === "undefined") {
BrutusinForms.onResolutionFinished(source);
};
BrutusinForms.onResolutionStarted(source);
obj.schemaResolver(arr, obj.getData(), cb);
obj.schemaResolver(arr, obj.getData(), cb, source);


}