Skip to content

Use Zod 4 JSON schema generation - #267

Merged
Ian Clanton-Thuon (iclanton) merged 1 commit into
SharePoint:mainfrom
iclanton:iclanton/use-zod-4-json-schema
Aug 12, 2026
Merged

Use Zod 4 JSON schema generation#267
Ian Clanton-Thuon (iclanton) merged 1 commit into
SharePoint:mainfrom
iclanton:iclanton/use-zod-4-json-schema

Conversation

@iclanton

Copy link
Copy Markdown
Contributor

Description

Migrates the Copilot component templates and examples to Zod 4 and uses Zod's native toJSONSchema() API. This removes the zod-to-json-schema dependency and allows the repository to use a single Zod version.

How was this tested?

  • rush build --to @microsoft/spfx-cli --to @microsoft/spfx-template-api --to @spfx-template/copilot-component-minimal --to @spfx-template/copilot-component-noframework --to @spfx-template/copilot-component-react
  • rush build --to @microsoft/spfx-template-test

Type of change

  • Bug fix
  • New feature / enhancement
  • Template change
  • Documentation / CI / governance

Copilot AI lite review requested due to automatic review settings August 12, 2026 15:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates the Copilot component templates/examples to Zod 4 and switches JSON schema generation to Zod’s native toJSONSchema() API, removing the direct zod-to-json-schema dependency and aligning the repo on a single Zod version.

Changes:

  • Replaced zod-to-json-schema usage with propertiesSchema.toJSONSchema() in Copilot component templates and examples.
  • Updated template/example dependencies to zod@^4.4.3 and removed direct zod-to-json-schema dependencies.
  • Updated Rush common versions / lockfiles to reflect the single Zod version across the repo.

Reviewed changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
templates/copilot-component-react/src/{componentName.pascal}Properties.ts Switch JSON schema export to Zod 4 toJSONSchema() and remove zod-to-json-schema import.
templates/copilot-component-react/package.json Remove zod-to-json-schema; bump Zod to ^4.4.3.
templates/copilot-component-noframework/src/{componentName.pascal}Properties.ts Switch JSON schema export to Zod 4 toJSONSchema() and remove zod-to-json-schema import.
templates/copilot-component-noframework/package.json Remove zod-to-json-schema; bump Zod to ^4.4.3.
templates/copilot-component-minimal/src/{componentName.pascal}Properties.ts Switch JSON schema export to Zod 4 toJSONSchema() and remove zod-to-json-schema import.
templates/copilot-component-minimal/package.json Remove zod-to-json-schema; bump Zod to ^4.4.3.
examples/copilot-component-react/src/SampleProperties.ts Switch JSON schema export to Zod 4 toJSONSchema() and remove zod-to-json-schema import.
examples/copilot-component-react/package.json Remove zod-to-json-schema; bump Zod to ^4.4.3.
examples/copilot-component-noframework/src/NoFrameworkProperties.ts Switch JSON schema export to Zod 4 toJSONSchema() and remove zod-to-json-schema import.
examples/copilot-component-noframework/package.json Remove zod-to-json-schema; bump Zod to ^4.4.3.
examples/copilot-component-minimal/src/MinimalProperties.ts Switch JSON schema export to Zod 4 toJSONSchema() and remove zod-to-json-schema import.
examples/copilot-component-minimal/package.json Remove zod-to-json-schema; bump Zod to ^4.4.3.
common/config/rush/repo-state.json Update Rush repo state hash for the lockfile change.
common/config/rush/pnpm-lock.yaml Update lockfile to Zod 4.4.3 and remove the Zod 3.x entries used by templates previously.
common/config/rush/common-versions.json Remove the preferred-version pinning/comments for Zod 3.x now that templates are on Zod 4.
common/changes/@microsoft/spfx-cli/main_2026-08-12-14-49-33.json Add Rush change file (type none, empty comment).
apps/spfx-cli/package.json Align CLI dependency on Zod to ^4.4.3.
api/spfx-template-api/package.json Align template API dependency on Zod to ^4.4.3.
Files not reviewed (1)
  • common/config/rush/pnpm-lock.yaml: Generated file

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@iclanton
Ian Clanton-Thuon (iclanton) merged commit 6ee265f into SharePoint:main Aug 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants