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
d6a7ebde
Commit
d6a7ebde
authored
Sep 11, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
support oneOf
parent
af5b3f95
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
jsonform.gadget.js
jsonform.gadget.js
+10
-6
No files found.
jsonform.gadget.js
View file @
d6a7ebde
...
@@ -443,6 +443,7 @@
...
@@ -443,6 +443,7 @@
break
;
break
;
case
"
allOf
"
:
case
"
allOf
"
:
case
"
anyOf
"
:
case
"
anyOf
"
:
case
"
oneOf
"
:
case
"
$ref
"
:
case
"
$ref
"
:
case
"
id
"
:
case
"
id
"
:
case
"
$id
"
:
case
"
$id
"
:
...
@@ -456,6 +457,7 @@
...
@@ -456,6 +457,7 @@
switch
(
key
)
{
switch
(
key
)
{
case
"
allOf
"
:
case
"
allOf
"
:
case
"
anyOf
"
:
case
"
anyOf
"
:
case
"
oneOf
"
:
case
"
$ref
"
:
case
"
$ref
"
:
break
;
break
;
default
:
default
:
...
@@ -473,7 +475,7 @@
...
@@ -473,7 +475,7 @@
var
i
,
var
i
,
arr
=
[];
arr
=
[];
for
(
i
=
0
;
i
<
schema_array
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
schema_array
.
length
;
i
+=
1
)
{
arr
.
push
(
expandSchema
(
g
,
schema_array
[
i
],
schema_path
+
'
/
allOf/
'
+
i
.
toString
()));
arr
.
push
(
expandSchema
(
g
,
schema_array
[
i
],
schema_path
+
'
/
'
+
i
.
toString
()));
}
}
return
RSVP
.
all
(
arr
);
return
RSVP
.
all
(
arr
);
})
})
...
@@ -507,14 +509,13 @@
...
@@ -507,14 +509,13 @@
});
});
}
}
function
anyOf
(
g
,
schema
,
schema_path
)
{
function
anyOf
(
g
,
schema_array
,
schema_path
,
base_schema
)
{
var
schema_array
=
schema
.
anyOf
;
return
RSVP
.
Queue
()
return
RSVP
.
Queue
()
.
push
(
function
()
{
.
push
(
function
()
{
var
i
,
var
i
,
arr
=
[];
arr
=
[];
for
(
i
=
0
;
i
<
schema_array
.
length
;
i
+=
1
)
{
for
(
i
=
0
;
i
<
schema_array
.
length
;
i
+=
1
)
{
arr
.
push
(
expandSchema
(
g
,
mergeSchemas
(
schema_array
[
i
],
schema
),
schema_path
+
'
/anyOf
/
'
+
i
.
toString
()));
arr
.
push
(
expandSchema
(
g
,
mergeSchemas
(
schema_array
[
i
],
base_schema
),
schema_path
+
'
/
'
+
i
.
toString
()));
}
}
return
RSVP
.
all
(
arr
);
return
RSVP
.
all
(
arr
);
})
})
...
@@ -544,10 +545,13 @@
...
@@ -544,10 +545,13 @@
schema
=
true
;
schema
=
true
;
}
}
if
(
schema
.
anyOf
!==
undefined
)
{
if
(
schema
.
anyOf
!==
undefined
)
{
return
anyOf
(
g
,
schema
,
schema_path
);
return
anyOf
(
g
,
schema
.
anyOf
,
schema_path
+
'
/anyOf
'
,
schema
);
}
if
(
schema
.
oneOf
!==
undefined
)
{
return
anyOf
(
g
,
schema
.
oneOf
,
schema_path
+
'
/oneOf
'
,
schema
);
}
}
if
(
schema
.
allOf
!==
undefined
)
{
if
(
schema
.
allOf
!==
undefined
)
{
return
allOf
(
g
,
schema
.
allOf
,
schema_path
,
schema
);
return
allOf
(
g
,
schema
.
allOf
,
schema_path
+
'
/allOf
'
,
schema
);
}
}
if
(
schema
.
$ref
)
{
if
(
schema
.
$ref
)
{
return
loadJSONSchema
(
g
,
schema
.
$ref
,
schema_path
);
return
loadJSONSchema
(
g
,
schema
.
$ref
,
schema_path
);
...
...
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