You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Validation decorators are now inherited between classes.
Fix issue #1: support union types like "number | null":
When the "design:type" metadata is "Object", we no longer try to guess the schema type. This means that you need to explicitly decorate the property with a type schema like "ObjectSchema()".
"Object" is now an allowed "design:type" for any decorator, no matter what allowed types have been specified in the constraint decorator.
The error message given when the Joi schema cannot be inferred from the "design:type" metadata has changed to: No validation schema exists, nor could it be inferred from the design:type metadata, for property "${propertyKey}". Please decorate the property with a type schema.
Metadata retrieval/storage of the schema is now done at its "own" level, not checking the whole prototype chain.
@nested() does not allow an implicit design:type of "Object". It also returns a different error message when no nested class has been provided: Could not determine the type of the nested property "${ propertyKey }". Please pass the class to the Nested() decorator.
Change some "Object" types to "object", since I think they don't actually want to accept "number" or "string" types.
Update to output ES6 code. (Turns out we're using ES6 functionality anyway, like Object.getPrototypeOf()).
Keep the working validation schema in a separate bit of metadata. (This will let us implement inheritance, by traversing the prototype chain and combining all schemas.)
ValidationResult is now a discriminated union, so you can distinguish between validation passes and failure at compile time.
The @keys() decorator now accepts a type parameter, so you can enforce that the schema you pass in only has keys in the provided type. This should still work without specifying a type parameter.
Update to TypeScript 2.6
TypeScript: Turn on all strict options.
Turn on strict function checks (contravariance checks). This requires changing all constraint decorator update functions, so they accept a "Schema", then casting the schema to the sub-type within the function body.
Object constraints that relate to peers, such as And, Nand, Xor, OptionalKeys etc, now use "keyof" types and must be passed a type parameter representing the class/type/interface being validated.
Constraint decorators that accept multiple arguments as a "rest" parameter now enforce that at least one argument must be provided.
Boolean Truthy and Falsy decorators don't accept a boolean, strangely enough!
Boolean decorators no longer need to cast the schema to "any", thanks to updated Joi type definitions.
Remove console.log() statement from verifyPeers()
package.json: Set engines to allow higher versions.
package.json: Set "joi" and "@types/joi" as peer dependencies. Allow versions greater than those used for development.
package.json: Add "joi" as a dev dependency.
TSC: Don't emit source maps when publishing. Without the .ts files, I don't think they serve any purpose.
.npmignore is now a whitelist; no more random files getting published to NPM.