0.16.1 (2022-04-29)
Features
- exposes payload within server-side validation args (e46b942)
Tag Name: v0.16.1
Release Date: 4/29/2022
Payload CMSPayload CMS is a modern, self-hosted headless content management system built with TypeScript, Node.js, and MongoDB. It's designed specifically for developers who want full control over their content management system while maintaining a powerful admin interface for content editors.
Payload CMS v0.16.1 is a minor release that exposes the payload instance within server-side validation arguments, allowing for more powerful validation logic. This update enables developers to access the full payload API during field validation, opening up possibilities for complex validation scenarios that require database queries or other payload operations.
No migration is required for this release. The new feature is additive and doesn't break existing functionality.
If you're already using server-side validation functions, you can now optionally access the payload instance through the validation arguments without any changes to your existing code.
This is a minor feature release that adds functionality without breaking changes. It's safe to upgrade from v0.16.0 to v0.16.1 without code modifications.
To upgrade:
npm install [email protected]
# or
yarn add [email protected]
No specific bug fixes were mentioned in this release.
The payload instance is now exposed within server-side validation arguments, providing access to the full payload API during field validation. This enhancement allows developers to:
Example usage:
{
fields: [
{
name: 'title',
type: 'text',
validate: async (value, { payload }) => {
// Now you can use payload to query other collections
const existingDocs = await payload.find({
collection: 'posts',
where: {
title: {
equals: value
}
}
});
if (existingDocs.totalDocs > 0) {
return 'A post with this title already exists';
}
return true;
}
}
]
}
No security fixes were mentioned in this release.
No specific performance improvements were mentioned in this release.
This release enhances the developer experience by providing access to the payload instance within server-side validation functions. This is particularly valuable for implementing complex validation rules that need to query the database or use other payload functionality.
The change is non-breaking and purely additive, meaning existing validation functions will continue to work as before. Developers can now optionally leverage the payload instance in their validation logic when needed.
Internal testing for localization default values was also included in this release, though no user-facing changes related to this were mentioned.