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
Jérome Perrin
rjs_json_form
Commits
e9ac0240
Commit
e9ac0240
authored
Aug 15, 2018
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix expanding schema if used predownloaded schema
parent
51fc22b2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
18 deletions
+38
-18
jsonform.gadget.js
jsonform.gadget.js
+38
-18
No files found.
jsonform.gadget.js
View file @
e9ac0240
...
...
@@ -186,22 +186,17 @@
url
,
download_url
,
hash
,
schema_url_map
,
mapped_schema
,
queue
;
// XXX need use `id` property
if
(
!
path
)
{
path
=
"
/
"
;
}
url
=
convertUrlToAbsolute
(
g
,
path
,
$ref
,
window
.
location
);
download_url
=
url
.
origin
+
url
.
pathname
;
schema_url_map
=
{
"
http://json-schema.org/draft-04/schema
"
:
"
json-schema/schema4.json
"
,
"
http://json-schema.org/draft-06/schema
"
:
"
json-schema/schema6.json
"
,
"
http://json-schema.org/draft-07/schema
"
:
"
json-schema/schema7.json
"
,
"
http://json-schema.org/schema
"
:
"
json-schema/schema7.json
"
};
if
(
schema_url_map
.
hasOwnProperty
(
download_url
))
{
url
=
new
URL
(
schema_url_map
[
download_url
],
g
.
__path
);
download_url
=
url
.
origin
+
url
.
pathname
+
url
.
search
;
mapped_schema
=
g
.
props
.
schemas
[
download_url
];
if
(
typeof
mapped_schema
===
"
string
"
)
{
url
=
new
URL
(
mapped_schema
,
g
.
__path
);
}
protocol
=
url
.
protocol
;
if
(
protocol
===
"
http:
"
||
protocol
===
"
https:
"
)
{
...
...
@@ -210,10 +205,15 @@
// throw new Error("You cannot mixed http and https calls");
}
}
download_url
=
url
.
origin
+
url
.
pathname
;
download_url
=
url
.
origin
+
url
.
pathname
+
url
.
search
;
hash
=
url
.
hash
;
url
=
url
.
href
;
if
(
download_url
.
startsWith
(
"
urn:jio:
"
))
{
if
(
typeof
mapped_schema
===
"
object
"
)
{
queue
=
RSVP
.
Queue
()
.
push
(
function
()
{
return
mapped_schema
;
});
}
else
if
(
download_url
.
startsWith
(
"
urn:jio:
"
))
{
queue
=
RSVP
.
Queue
()
.
push
(
function
()
{
return
g
.
downloadJSON
(
download_url
);
...
...
@@ -567,6 +567,12 @@
// it's need for schema uri computation
g
.
props
.
schema
=
{};
g
.
props
.
schema_map
=
{};
g
.
props
.
schemas
=
{
"
http://json-schema.org/draft-04/schema
"
:
"
json-schema/schema4.json
"
,
"
http://json-schema.org/draft-06/schema
"
:
"
json-schema/schema6.json
"
,
"
http://json-schema.org/draft-07/schema
"
:
"
json-schema/schema7.json
"
,
"
http://json-schema.org/schema
"
:
"
json-schema/schema7.json
"
};
// schema_required_urls[path] = [
// stack required urls, on every unrequired field stack begining from []
// "url1",
...
...
@@ -590,14 +596,28 @@
}
})
.
push
(
function
()
{
if
(
schema
)
{
return
schema
;
var
schema_url
,
queue
;
if
(
schema
!==
undefined
)
{
schema_url
=
g
.
state
.
schema_url
||
schema
.
$id
||
schema
.
id
||
window
.
location
.
toString
();
g
.
props
.
schema
[
""
]
=
schema
;
g
.
props
.
schema_map
[
"
/
"
]
=
schema_url
;
g
.
props
.
schemas
[
schema_url
]
=
schema
;
queue
=
expandSchemaForField
(
g
,
schema
,
"
/
"
,
true
);
}
else
{
schema_url
=
g
.
state
.
schema_url
||
(
json_document
&&
json_document
.
$schema
);
if
(
schema_url
)
{
queue
=
loadJSONSchema
(
g
,
schema_url
);
}
}
var
schema_url
=
g
.
state
.
schema_url
||
(
json_document
&&
json_document
.
$schema
);
if
(
schema_url
)
{
return
loadJSONSchema
(
g
,
schema_url
)
if
(
queue
)
{
return
queue
.
push
(
function
(
schema_arr
)
{
// XXX for root of form use first schema selection
return
schema_arr
[
0
].
schema
;
});
}
...
...
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