Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
f4865f49
Commit
f4865f49
authored
Dec 19, 2014
by
Ioannis Papagiannopoulos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
expandSchema method updated for the new interruption>failure definition of schema
parent
2f8367d9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
13 deletions
+77
-13
dream/platform/src/jsplumb/jsplumb.js
dream/platform/src/jsplumb/jsplumb.js
+77
-13
No files found.
dream/platform/src/jsplumb/jsplumb.js
View file @
f4865f49
...
...
@@ -397,14 +397,18 @@
// minimal expanding of json schema, supports merging allOf and $ref
// references
// TODO: check for a library that would provide full support
console
.
log
(
"
expandSCHEMA 1
"
);
var
property
,
referenced
,
i
,
j
,
len
,
expanded_class_definition
=
{
properties
:
class_definition
.
properties
||
{}},
ref_word_list
,
ref_word
,
ref_definition_list
,
ref_definition_word
,
ref_definition
,
ref_definition_word
,
ref_definition
_root
,
ref_definition
,
sub_ref_def
,
sub_ref_def_list
,
sub_ref_def_word
,
sub_ref_def_root
;
sub_ref_def_word
,
sub_ref_def_root
,
prop
;
console
.
log
(
"
expandSCHEMA 1
"
);
console
.
log
(
class_definition
);
console
.
log
(
full_schema
);
console
.
log
(
expanded_class_definition
);
if
(
class_definition
.
allOf
)
{
for
(
i
=
0
;
i
<
class_definition
.
allOf
.
length
;
i
+=
1
)
{
referenced
=
class_definition
.
allOf
[
i
];
...
...
@@ -417,14 +421,15 @@
}
// console.log(full_schema.class_definition.definitions);
if
(
referenced
.
properties
)
{
//
console.log("[[[[[[[[[[]]]]]]]]]]");
//
console.log(referenced.properties);
console
.
log
(
"
[[[[[[[[[[]]]]]]]]]]
"
);
console
.
log
(
referenced
.
properties
);
for
(
property
in
referenced
.
properties
)
{
if
(
referenced
.
properties
.
hasOwnProperty
(
property
))
{
if
(
referenced
.
properties
[
property
].
type
||
referenced
.
properties
[
property
].
$ref
)
{
// console.log("..");
// console.log(property);
console
.
log
(
"
..
"
);
console
.
log
(
property
);
console
.
log
(
referenced
.
properties
[
property
]);
if
(
referenced
.
properties
[
property
].
$ref
)
{
ref_definition_list
=
referenced
.
properties
[
property
].
$ref
.
split
(
"
/
"
);
...
...
@@ -433,26 +438,20 @@
ref_definition
=
full_schema
.
class_definition
.
definitions
[
ref_definition_word
];
// console.log("(((((((())))))))");
// console.log(ref_definition);
if
(
ref_definition
.
allOf
)
{
if
(
ref_definition
.
allOf
[
1
].
oneOf
)
{
len
=
ref_definition
.
allOf
[
1
].
oneOf
.
length
-
1
;
for
(
j
=
0
;
j
<=
len
;
j
+=
1
)
{
// console.log("--------- " + j);
// console.log(ref_definition.allOf[1].oneOf[j]);
if
(
ref_definition
.
allOf
[
1
]
.
oneOf
[
j
].
$ref
)
{
sub_ref_def_list
=
ref_definition
.
allOf
[
1
]
.
oneOf
[
j
].
$ref
.
split
(
"
/
"
);
// console.log(">>>>>>");
sub_ref_def_word
=
sub_ref_def_list
[
sub_ref_def_list
.
length
-
1
];
sub_ref_def_root
=
sub_ref_def_list
[
sub_ref_def_list
.
length
-
2
];
sub_ref_def
=
full_schema
.
class_definition
.
definitions
[
sub_ref_def_root
][
sub_ref_def_word
];
// console.log(sub_ref_def);
ref_definition
.
allOf
[
1
].
oneOf
[
j
]
=
sub_ref_def
;
}
}
...
...
@@ -463,6 +462,71 @@
//console.log("for property " + property + ", definition:");
//console.log(ref_definition);
}
else
{
if
(
referenced
.
properties
[
property
].
properties
)
{
console
.
log
(
"
not a reference
"
);
console
.
log
(
referenced
.
properties
[
property
].
properties
);
for
(
prop
in
referenced
.
properties
[
property
]
.
properties
)
{
if
(
referenced
.
properties
[
property
]
.
properties
.
hasOwnProperty
(
prop
))
{
console
.
log
(
7
);
console
.
log
(
prop
);
console
.
log
(
referenced
.
properties
[
property
]
.
properties
[
prop
]);
if
(
referenced
.
properties
[
property
]
.
properties
[
prop
].
$ref
)
{
console
.
log
(
"
!!!!
"
);
ref_definition_list
=
referenced
.
properties
[
property
]
.
properties
[
prop
].
$ref
.
split
(
"
/
"
);
console
.
log
(
ref_definition_list
);
ref_definition_word
=
ref_definition_list
[
ref_definition_list
.
length
-
1
];
console
.
log
(
ref_definition_word
);
ref_definition_root
=
ref_definition_list
[
ref_definition_list
.
length
-
2
];
console
.
log
(
ref_definition_root
);
ref_definition
=
full_schema
.
class_definition
[
ref_definition_root
][
ref_definition_word
];
console
.
log
(
ref_definition
);
if
(
ref_definition
.
allOf
)
{
if
(
ref_definition
.
allOf
[
1
].
oneOf
)
{
len
=
ref_definition
.
allOf
[
1
].
oneOf
.
length
-
1
;
for
(
j
=
0
;
j
<=
len
;
j
+=
1
)
{
if
(
ref_definition
.
allOf
[
1
]
.
oneOf
[
j
].
$ref
)
{
sub_ref_def_list
=
ref_definition
.
allOf
[
1
]
.
oneOf
[
j
].
$ref
.
split
(
"
/
"
);
sub_ref_def_word
=
sub_ref_def_list
[
sub_ref_def_list
.
length
-
1
];
sub_ref_def_root
=
sub_ref_def_list
[
sub_ref_def_list
.
length
-
2
];
sub_ref_def
=
full_schema
.
class_definition
.
definitions
[
sub_ref_def_root
][
sub_ref_def_word
];
ref_definition
.
allOf
[
1
].
oneOf
[
j
]
=
sub_ref_def
;
}
}
}
}
referenced
.
properties
[
property
].
properties
[
prop
]
=
ref_definition
;
}
}
}
}
expanded_class_definition
.
properties
[
property
]
=
referenced
.
properties
[
property
];
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment