payload-schema — Optimization
Choose optionality for projections
Section titled “Choose optionality for projections”A plain pick(keys) makes all picked keys required. Set the optional option when the projection should respect optional fields.
Preserve block metadata
Section titled “Preserve block metadata”Reserve id, blockName and blockType in block definitions. Reusing those names throws INVALID_FIELD_CONFIGURATION.
Keep server code out of client bundles
Section titled “Keep server code out of client bundles”Use the universal root entry for shared schemas. Import the ./payload compiler only in Node.js Payload configuration.
Choose codec-safe transformations
Section titled “Choose codec-safe transformations”Custom schema transforms are not codec-safe for z.encode. Use .refine() or .overwrite() when schemas serve as operation outputs.