Payload CMS Release: Release 1.0.25
Tag Name: v1.0.25
Release Date: 8/17/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.
TL;DR
Payload CMS v1.0.25 introduces custom API endpoints, allowing developers to create their own routes within the Payload API. This release also adds a new 'monthOnly' date picker option and migrates collection updates from PUT to PATCH requests (with backward compatibility). A GraphQL schema bug related to required block fields has been fixed. This update enhances developer flexibility while maintaining API stability.
Highlight of the Release
- Introduction of custom API endpoints for creating your own routes within the Payload API
- New 'monthOnly' date picker appearance option for simpler date selection
- Migration from PUT to PATCH for collection updates (with backward compatibility)
- Fixed GraphQL schema bug related to required block fields
Migration Guide
Migrating from PUT to PATCH for Collection Updates
Payload has migrated from using PUT to PATCH for collection updates. While PUT requests will continue to work for backward compatibility, they are now deprecated and will show a deprecation warning.
To update your code:
- Change your collection update requests from PUT to PATCH
- Example:
// Old (deprecated) await fetch(`/api/your-collection/${id}`, { method: 'PUT', body: JSON.stringify(data), // ...other options }) // New (recommended) await fetch(`/api/your-collection/${id}`, { method: 'PATCH', body: JSON.stringify(data), // ...other options })
This change better aligns with REST API conventions, where PATCH is used for partial updates and PUT for complete replacements.
Upgrade Recommendations
This is a minor release with new features and bug fixes. It's recommended to upgrade to take advantage of the new custom API endpoints feature and the 'monthOnly' date picker option.
The migration from PUT to PATCH for collection updates includes backward compatibility, so existing code will continue to work, though you should plan to update your API calls to use PATCH instead of PUT in the future.
To upgrade:
npm install [email protected]
# or
yarn add [email protected]
After upgrading, review your code for any PUT requests to collection endpoints and consider updating them to PATCH to avoid deprecation warnings.
Bug Fixes
Fixed GraphQL Schema Issue with Required Block Fields
Fixed an issue (#568) where the GraphQL schema wasn't properly handling the 'required' property for block fields. This bug could cause incorrect null-ability checks in GraphQL queries involving block fields.
Other Code Improvements
- Removed unreachable return statements
- Improved type safety by using type variables instead of 'as' keyword for JWT decoding
- Fixed validation by reusing endpoint schemas
New Features
Custom API Endpoints
Payload now supports creating custom API endpoints directly within your Payload configuration. This powerful feature allows developers to define their own routes within the Payload API, enabling custom functionality beyond the standard CRUD operations.
New Date Picker Appearance Option: 'monthOnly'
The date picker component now supports a new pickerAppearance option called 'monthOnly'. When enabled, this option simplifies the date selection interface by only allowing users to select a month and year, without specifying a day. This is particularly useful for scenarios where day-level precision isn't required.
Security Updates
No security fixes were explicitly mentioned in this release.
Performance Improvements
No significant performance improvements were explicitly mentioned in this release. The code improvements and refactoring may have minor performance benefits, but these were not highlighted as performance-focused changes.
Impact Summary
Payload CMS v1.0.25 enhances developer flexibility with custom API endpoints and improves the date picker component with a new 'monthOnly' option. The migration from PUT to PATCH for collection updates aligns the API with REST conventions while maintaining backward compatibility. A GraphQL schema bug fix ensures proper handling of required block fields.
This release primarily impacts developers by providing more tools for customization and API design. Content editors benefit from the simplified month-only date picker option. The changes are backward compatible, making this a safe upgrade that opens new possibilities without breaking existing implementations.
The introduction of custom API endpoints is particularly significant as it allows developers to extend Payload's functionality in new ways, creating specialized routes for custom business logic directly within the Payload API structure.
Full Release Notes
Statistics:
User Affected:
- Can now create custom API endpoints within the Payload API
- Should update their code to use PATCH instead of PUT for collection updates (PUT still works but is deprecated)
- Have access to a new 'monthOnly' option for date pickers
