Skip to content

Releases: AndrewBastin/verzod

v0.5.1

12 Jan 14:12

Choose a tag to compare

This release fixes a bug in isLatest() where it could incorrectly return true even when getVersion() indicated the entity wasn't actually at the latest version. The function now properly validates the version number, aligning its behavior with is().

What's Changed

  • Check version number in isLatest() (as in is()) by @janbaykara in #8

Full Changelog: v0.5.0...v0.5.1

v0.5.0

02 Jan 17:04

Choose a tag to compare

This release mainly improves migration safety by formally validating the results of up functions during migrations.
Previously, if an up function returned data that didn't match the target schema, it could lead to subtle runtime issues. Now, verzod validates migration outputs and provides clear error messages when schema mismatches occur.

Caution

Possible behavior change for cyclic/nested entities

Because migration results are now parsed through the target schema, any entityReference transforms in the schema will be applied to the up function's output. This means nested entities will now be automatically migrated to the target version by the schema's entityRefUptoVersion transform.

Before: Nested children stayed at whatever version your up function returned them as.
After: Nested children are migrated to the target version by the schema's transform after up completes.

If your up functions relied on children remaining at their original version, you may need to adjust your migration logic.

What's Changed

  • fix: formally validate up results during migrations by @janbaykara in #7
  • chore: bump dependencies and switch to node 24 for nix dev shell by @AndrewBastin in d330aff

New Contributors

Full Changelog: v0.4.0...v0.5.0

v0.4.0

30 Jul 18:01

Choose a tag to compare

This release introduces direct access to the latest entity schema and includes development tooling improvements.

The new latestSchema getter property allows you to access the Zod schema of the latest version of an entity directly. This is useful when you need to work with the raw Zod schema in existing validation workflows:

const Environment = createVersionedEntity({
  latestVersion: 2,
  versionMap: { /* ... */ },
  getVersion: (data) => data.v
})

// Access the latest schema directly
const latestSchema = Environment.latestSchema // Returns the z.object() schema for version 2

// Use it with existing Zod workflows
const result = latestSchema.safeParse(someData)

What's Changed

Contributors

Full Changelog: v0.3.0...v0.4.0

v0.3.0

04 Jun 13:08

Choose a tag to compare

This release focuses on introducing features around adding upTo-series of functions for pinned entity references.

New upTo Version-Bounded Functions

This release introduces powerful version-bounded parsing and migration capabilities, allowing you to parse and migrate entities only up to a specific version rather than always migrating to the latest. This is particularly useful for recursive entity definitions where entities reference themselves.

Key additions:

  • VersionedEntity.isUpToVersion(data, version) - Type guard to check if data is valid for any version up to the specified version
  • VersionedEntity.safeParseUpToVersion(data, version) - Parse and migrate data up to a specific version (not beyond)
  • entityRefUptoVersion(entity, version) - Create Zod schemas for version-bounded entity references

When migrating recursive structures (like trees), you can now ensure that child entities are only migrated up to the version you're currently migrating to, preventing issues where children might be migrated to future versions that didn't exist when you wrote the migration logic.

What's Changed

  • feat: ability to define entity references up to a specific version by @AndrewBastin

Full Changelog: v0.2.4...v0.3.0

v0.2.4

13 Jan 09:15

Choose a tag to compare

What's Changed

  • fix: update return type of entityReference to remove type recursion error issues by @AndrewBastin in #3

New Contributors

Full Changelog: v0.2.3...v0.2.4

v0.2.3

20 Mar 12:59

Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v0.2.2...v0.2.3

v0.2.2

14 Nov 16:51

Choose a tag to compare

This is a small patch fix update for a fix with how InferredEntity deals with Zod schemas that have a catch schema applied on them resolving to undefined.

What's Changed

Full Changelog: v0.2.0...v0.2.2

v0.2.0

13 Nov 08:34

Choose a tag to compare

What's Changed

  • chore: introduce test:watch command for development testing.
  • feat: introduce entityReference function that returns a custom zod schema to refer to an entity in a zod schema
  • chore: update README to feature the usage of entityReference
  • chore: move zod from dependency to as a peerDependency.

Full Changelog: v0.1.1...v0.2.0

v0.1.1

15 Oct 04:49

Choose a tag to compare

What's Changed

  • chore: add types field in package.json (6631e95)

Full Changelog: v0.1.0...v0.1.1

v0.1.0 - Initial Release

14 Oct 13:41

Choose a tag to compare

This marks the initial release of the library.

Full Changelog: https://github.com/AndrewBastin/verzod/commits/v0.1.0