Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
R
rjs_json_form
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
rjs_json_form
Commits
e1cefbfd
Commit
e1cefbfd
authored
Oct 17, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
set empty object/array for required properties/items
parent
9cec5e6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
1 deletion
+11
-1
jsonform/gadget_json_generated_form_child.js
jsonform/gadget_json_generated_form_child.js
+11
-1
No files found.
jsonform/gadget_json_generated_form_child.js
View file @
e1cefbfd
...
...
@@ -1071,6 +1071,9 @@
div
.
setAttribute
(
"
data-parent-scope
"
,
gadget
.
element
.
getAttribute
(
"
data-gadget-scope
"
));
div
.
setAttribute
(
"
data-json-path
"
,
first_path
+
'
/
'
);
div
.
setAttribute
(
"
data-json-type
"
,
type
);
if
(
options
.
required
)
{
div
.
setAttribute
(
"
data-json-required
"
,
"
true
"
);
}
}
if
(
schema
.
info
!==
undefined
)
{
...
...
@@ -1549,12 +1552,19 @@
}
// set empty object
if default value require thi
s
// set empty object
/array for required properties/item
s
array
=
g
.
element
.
querySelectorAll
(
"
div[data-parent-scope='
"
+
g
.
element
.
getAttribute
(
"
data-gadget-scope
"
)
+
"
']
"
);
for
(
i
=
0
;
i
<
array
.
length
;
i
+=
1
)
{
path
=
array
[
i
].
getAttribute
(
"
data-json-path
"
).
slice
(
0
,
-
1
);
if
(
array
[
i
].
hasAttribute
(
"
data-json-required
"
))
{
if
(
array
[
i
].
getAttribute
(
"
data-json-type
"
)
===
"
object
"
)
{
convertOnMultiLevel
(
multi_level_dict
,
path
,
{});
}
else
{
convertOnMultiLevel
(
multi_level_dict
,
path
,
[]);
}
}
}
for
(
path
in
options
.
arrays
)
{
...
...
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