Commit 06b74a59 authored by Boris Kocherov's avatar Boris Kocherov

correctly set g.props.type for empty document generation

parent fa804cb1
...@@ -41,6 +41,9 @@ ...@@ -41,6 +41,9 @@
} }
function getDocumentType(doc) { function getDocumentType(doc) {
if (doc === undefined) {
return;
}
if (doc === null) { if (doc === null) {
return "null"; return "null";
} }
...@@ -1620,7 +1623,10 @@ ...@@ -1620,7 +1623,10 @@
if (!options.type && schema && !schema.type) { if (!options.type && schema && !schema.type) {
options.type = guessSchemaType(schema); options.type = guessSchemaType(schema);
} }
g.props.type = options.type; // used for empty document generation
g.props.type = getDocumentType(options.document) ||
(schema && typeof schema.type === "string" && schema.type) ||
options.type;
while (root.firstChild) { while (root.firstChild) {
root.removeChild(root.firstChild); root.removeChild(root.firstChild);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment