br(v28): Making zod plugin an optional peer dependency.#3313
br(v28): Making zod plugin an optional peer dependency.#3313
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
775c430 to
24a20f9
Compare
24a20f9 to
3fd3515
Compare
24eaac6 to
0826316
Compare
3660095 to
1a0bdb1
Compare
Found the lack of this feature while working on #3313 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Schema metadata now supports a brand property (symbol, string, or number) to record schema branding. * **Tests** * Expanded type-level tests to validate the new brand metadata along with existing default and examples fields. * **Documentation** * Changelog updated with a v4.1.0 entry describing the brand metadata support. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Clean decoupling. The migration from .brand() to .meta({ [brandProperty]: ... }) is consistent across all schema files, the Array.isArray guards on examples are the correct defensive change given the plugin is no longer guaranteed, and the satisfies typeof brandProp cross-package type import is a nice compile-time sync check with zero runtime cost. Impact analysis found no stale references. Two minor items below.
Task list (7/7 completed)
- Read the PR diff and identify major areas of change
- Review core changes: package.json, index.ts, and schema files
- Review zod-plugin package changes
- Review test changes
- Impact analysis: verify no stale references to removed/changed APIs
- Self-critique and draft review
- Submit review
Claude Opus | 𝕏
Co-authored-by: pullfrog[bot] <226033991+pullfrog[bot]@users.noreply.github.com>
|
Both review threads are resolved. The README typo was already fixed, and the vacuous test assertion was replaced with Task list (4/4 completed)
|
|
@pullfrog review again |
There was a problem hiding this comment.
No new issues. Reviewed the following changes:
- Consolidated
brand.tsintometadata.ts, renaming all imports across source and test files - Added
getExamples()helper that normalizesglobalRegistryexamples to always return an array - Applied
getExamples()inendpoint.tsandarrayResultHandler, simplifying the guard-and-extract pattern - Deleted
brand.spec.tsand createdmetadata.spec.tscovering bothgetBrand()andgetExamples()
Prior review feedback:
- Typo "preferrably" → "preferably" — addressed in 93f06f3
- Vacuous
{}assertion inzod-plugin/tests/index.spec.ts— addressed in 2cfd4c9
Claude Opus | 𝕏
There was a problem hiding this comment.
Approving — the consolidation into metadata.ts and the new getExamples() helper are clean. The one inline comment is a minor consistency suggestion, not blocking.
Claude Opus | 𝕏
|
No code changes needed — the Task list (3/3 completed)
|
This one is no longer needed because custom schemas of `ez` namespace no
longer use those symbols for `ZodBranded`.
Using `.brand()` replaced to `.meta({ "x-brand": ... })` in #3313

Making zod plugin an optional peer dependency.
Since branding moved to regular metadata, the framework could operate without the plugin, but the plugin could be an opt-in feature to enable the methods of convenience, such as
.example().This could simplify the framework, its bundling and make it free of side effects by default.
Breaking changes list:
getBrand()moved from Zod plugin to the framework;@express-zod-api/zod-pluginand import it manually IF they want to continue using convenience methods such asZodType::example()