Browse Source

ValidationSchema type update

tags/v1.0.0-alpha.3
ojizero 1 year ago
parent
commit
d6aa4d53b1
No account linked to committer's email address
3 changed files with 5 additions and 3 deletions
  1. 1
    1
      package-lock.json
  2. 1
    1
      package.json
  3. 3
    1
      src/validation.ts

+ 1
- 1
package-lock.json View File

@@ -1,6 +1,6 @@
{
"name": "@ojizero/portal",
"version": "1.0.0-alpha.1",
"version": "1.0.0-alpha.3",
"lockfileVersion": 1,
"requires": true,
"dependencies": {

+ 1
- 1
package.json View File

@@ -1,6 +1,6 @@
{
"name": "@ojizero/portal",
"version": "1.0.0-alpha.2",
"version": "1.0.0-alpha.3",
"description": "HTTP API clients ... simplified.",
"main": "lib/index.js",
"publishConfig": {

+ 3
- 1
src/validation.ts View File

@@ -13,7 +13,9 @@ function isJoiSchema (spec: any): spec is SchemaLike {
return !!spec && spec.isJoi
}

export type ValdiationSpec = SchemaLike | Validator
export type SimplifiedSpec = string | Array<string> | { [k: string]: SchemaLike | SimplifiedSpec }

export type ValdiationSpec = SchemaLike | Validator | SimplifiedSpec

export function ensureValidData (spec: ValdiationSpec | undefined, data: any, name?: string) {
if (!spec) return

Loading…
Cancel
Save