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