This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
ajv-ts@0.6.1
Patch Changes
1c4b78b: - fix default behavior.
Now you can pass undefined or null and your default values will be applies.
NOTE:default keyword will be applied for items and properties definition. That means default keyword will works only for object() and array() builders. See in ajv docs
Example:
import s from "ajv-ts";
const Person = s.object({
age: s.number().default(18),
});
// Before
Person.parse({}); // throws error
// Now
Person.parse({}); // returns { age: 18 }, default value
parse, safeParse and validate now can be called without arguments.
import s from "ajv-ts";
// Before
s.number().safeParse(); // Error, required at least 1 argument
// After
s.number().safeParse(); // ok now
expose default Ajv instance.
make object builder optional.
Example:
import s from "ajv-ts";
// Before
s.object(); // error, expected object
// After
s.object(); // OK, empty object definition
This PR was opened by the Changesets release GitHub action. When you're ready to do a release, you can merge this and the packages will be published to npm automatically. If you're not ready to do a release yet, that's fine, whenever you add more changesets to main, this PR will be updated.
Releases
ajv-ts@0.6.1
Patch Changes
1c4b78b: - fix
default
behavior.Now you can pass
undefined
ornull
and your default values will be applies.NOTE:
default
keyword will be applied foritems
andproperties
definition. That meansdefault
keyword will works only forobject()
andarray()
builders. See in ajv docsExample:
parse
,safeParse
andvalidate
now can be called without arguments.expose default
Ajv
instance.make
object
builder optional.Example: