Browse Source

ValidationSchema type update

modified-method-api v1.0.0-alpha.3
ojizero 4 years ago
parent
commit
d6aa4d53b1
No known key found for this signature in database
GPG Key ID: FEBB7097845B0C7E
  1. 2
      package-lock.json
  2. 2
      package.json
  3. 4
      src/validation.ts

2
package-lock.json generated

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

2
package.json

@ -1,6 +1,6 @@ @@ -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": {

4
src/validation.ts

@ -13,7 +13,9 @@ function isJoiSchema (spec: any): spec is SchemaLike { @@ -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