Fix schema
This commit is contained in:
parent
215bd55b99
commit
1f84e36f8c
@ -49,6 +49,9 @@ function dataURItoBlob(dataUrl) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getJsonType(f) {
|
function getJsonType(f) {
|
||||||
|
if (!sqlDataTypes.includes(f.type)) {
|
||||||
|
return '{ "type" : "object", additionalProperties : true }';
|
||||||
|
}
|
||||||
switch (f.type) {
|
switch (f.type) {
|
||||||
case "INT":
|
case "INT":
|
||||||
case "SMALLINT":
|
case "SMALLINT":
|
||||||
@ -76,7 +79,7 @@ function getJsonType(f) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function generateSchema(type) {
|
function generateSchema(type) {
|
||||||
return `{\n\t\t\t"type": "object",\n\t\t\t"properties": {\n\t\t\t\t${type.fields
|
return `{\n\t\t\t"$schema": "http://json-schema.org/draft-04/schema#",\n\t\t\t"type": "object",\n\t\t\t"properties": {\n\t\t\t\t${type.fields
|
||||||
.map((f) => `"${f.name}" : ${getJsonType(f)}`)
|
.map((f) => `"${f.name}" : ${getJsonType(f)}`)
|
||||||
.join(
|
.join(
|
||||||
",\n\t\t\t\t"
|
",\n\t\t\t\t"
|
||||||
|
Loading…
Reference in New Issue
Block a user