Fixing validation for datasource plugins.
This commit is contained in:
parent
ff84fd6bc9
commit
d9a8604994
|
@ -26,9 +26,9 @@
|
||||||
"outputPath": "build"
|
"outputPath": "build"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@budibase/backend-core": "1.2.28-alpha.0",
|
"@budibase/backend-core": "^1.2.38",
|
||||||
"@budibase/string-templates": "1.2.28-alpha.0",
|
"@budibase/string-templates": "^1.2.38",
|
||||||
"@budibase/types": "1.2.28-alpha.0",
|
"@budibase/types": "^1.2.38",
|
||||||
"axios": "0.21.2",
|
"axios": "0.21.2",
|
||||||
"chalk": "4.1.0",
|
"chalk": "4.1.0",
|
||||||
"cli-progress": "3.11.2",
|
"cli-progress": "3.11.2",
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
const { PluginTypes } = require("./constants")
|
const { PluginTypes } = require("./constants")
|
||||||
const { DatasourceFieldTypes, QueryTypes } = require("@budibase/types")
|
const { DatasourceFieldType, QueryType } = require("@budibase/types")
|
||||||
const joi = require("joi")
|
const joi = require("joi")
|
||||||
|
|
||||||
const DATASOURCE_TYPES = [
|
const DATASOURCE_TYPES = [
|
||||||
|
@ -36,7 +36,7 @@ function validateDatasource(schema) {
|
||||||
const fieldValidator = joi.object({
|
const fieldValidator = joi.object({
|
||||||
type: joi
|
type: joi
|
||||||
.string()
|
.string()
|
||||||
.allow(...Object.values(DatasourceFieldTypes))
|
.allow(...Object.values(DatasourceFieldType))
|
||||||
.required(),
|
.required(),
|
||||||
required: joi.boolean().required(),
|
required: joi.boolean().required(),
|
||||||
default: joi.any(),
|
default: joi.any(),
|
||||||
|
@ -45,7 +45,7 @@ function validateDatasource(schema) {
|
||||||
|
|
||||||
const queryValidator = joi
|
const queryValidator = joi
|
||||||
.object({
|
.object({
|
||||||
type: joi.string().allow(...Object.values(QueryTypes)),
|
type: joi.string().allow(...Object.values(QueryType)),
|
||||||
fields: joi.object().pattern(joi.string(), fieldValidator),
|
fields: joi.object().pattern(joi.string(), fieldValidator),
|
||||||
})
|
})
|
||||||
.required()
|
.required()
|
||||||
|
|
Loading…
Reference in New Issue