Releases: joiful-ts/joiful
Releases · joiful-ts/joiful
v0.0.13
Features
- #14, #30: decorators are now type safe. This means you will be prevented from applying a string constraint decorator on a number property, at compile time. (This replaces the previous runtime checking.)
- #27: Add decorator
@Error()
for Joi.any().error(). I've also added an alias,@CustomerError()
, to avoid conflicts with the built-in Error class.
Tech
- package.json: change the
yarn
engine entry to set the minimum supported version to 1.0.0, for consuming applications/projects that are forced to use older versions of yarn. - #18, #26: Migrate tests from Mocha to Jest. (Thanks @codeandcats!)
- #34: add .yarnrc, enforcing tsdv-joi use of yarn (save exact versions, don't accidentally modify the lockfile when running
yarn install
)
v0.0.12
Features
- #10: add
@Lazy()
decorator, for lazily evaluated schemas. This accepts a function that returns a Joi schema. If you want to use a schema class, you must pass the class togetJoiSchema()
.
Fixes
- #11:
@ObjectSchema()
can now be applied to properties with a class instance type. - #16:
@AnySchema()
could only be applied tonumber
properties! D'oh. - #28:
@Concat()
and@Empty()
decorators were not correctly using the passed in schema.
Tech
- Add yarn.lock file.
- Update TypeScript to v3.4.5
- #12: CircleCI tests are running again.
v0.0.11
- [FIX] Array constraints were not imported/exported properly.
v0.0.10
v0.0.9
- [FEATURE] Allow importing specific constraints using syntax like
import { Optional } from 'tsdv-joi/contraints/any';
- [TECH] Remove namespaces from each constraint module. You can still import wrappers like
AnyConstraints
(etc) fromtsdv-joi
. - [TECH] Remove
dist
from published sub-module paths. - [TECH] Add CircleCI integration for running unit tests automatically.
- [TECH] Modify the NPM publishing process.
v0.0.7
- 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.