-
Notifications
You must be signed in to change notification settings - Fork 10.3k
/
joi.ts
27 lines (26 loc) · 984 Bytes
/
joi.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import joi from "joi"
import { PluginOptionsSchemaJoi } from "./utils/plugin-options-schema-joi-type"
export * from "./utils/plugin-options-schema-joi-type"
export const Joi: PluginOptionsSchemaJoi = joi.extend({
// This tells Joi to extend _all_ types with .dotenv(), see
// https://github.com/sideway/joi/commit/03adf22eb1f06c47d1583617093edee3a96b3873
// @ts-ignore Joi types weren't updated with that commit, PR: https://github.com/sideway/joi/pull/2477
type: /^s/,
rules: {
// NOTE(@mxstbr): Disabled until we decide on the necessity for this API.
// dotenv: {
// args: [`name`],
// validate(value, helpers, args): void {
// if (!args.name) {
// return helpers.error(
// `any.dotenv requires the environment variable name`
// )
// }
// return value
// },
// method(name): Schema {
// return this.$_addRule({ name: `dotenv`, args: { name } })
// },
// },
},
})