Skip to content

Conversation

@ZhongpinWang
Copy link
Contributor

@ZhongpinWang ZhongpinWang commented Jul 23, 2025

Context

Closes SAP/ai-sdk-js-backlog#367.

What this PR does and why it is needed

In favor of Zod v4 (currently imported from Zod package v3 with the path zod/v4), we replaced ts-to-zod with orval.

As discussed with @deekshas8 , we decided to also remove the schema tests.

We now generate zod schema for prompt-registry as promptTemplatePostRequestSchema aka. the new registryControllerPromptControllerCreateUpdatePromptTemplateBody zod schema is used in Orchestration package for supporting prompt template in JSON string.

Sidenote:

We cannot at this point move to Zod package version v4 yet, as LangChain still depends on Zod package v3 (but support v4 contained by the v3 package). The toJSONSchema() won't parse description etc. in properties correctly if we provide a zod object created by package v4. I described this also in #854 (comment).

🤯 Notice: Zod package v4 ≠ Zod v4. Zod v4 can come from Zod package v4 or Zod package v3.

@ZhongpinWang ZhongpinWang force-pushed the replace-ts-to-zod-with-orval branch from 4d64917 to be740b2 Compare July 23, 2025 14:59
@ZhongpinWang ZhongpinWang requested a review from deekshas8 July 23, 2025 15:00
Copy link
Contributor

@deekshas8 deekshas8 left a comment

Choose a reason for hiding this comment

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

Can you also remove this schema-tests package from pnpm workspaces file?

@ZhongpinWang ZhongpinWang requested a review from deekshas8 July 25, 2025 09:00
@deekshas8
Copy link
Contributor

The object "registryControllerPromptControllerCreateUpdatePromptTemplateBodyaspromptTemplatePostRequestSchema" is exported from the index.ts but marked as @internal

This check is still failing. Since exporting it originally was a mistake anyway, I would remove it from the index.ts. Is also a quick win.

@ZhongpinWang
Copy link
Contributor Author

ZhongpinWang commented Jul 25, 2025

The object "registryControllerPromptControllerCreateUpdatePromptTemplateBodyaspromptTemplatePostRequestSchema" is exported from the index.ts but marked as @internal

This check is still failing. Since exporting it originally was a mistake anyway, I would remove it from the index.ts. Is also a quick win.

Cloud SDK PR is still not merged, thus, this error. But I can remove it and import from internal in orchestration. If not using alias, we will be importing registryControllerPromptControllerCreateUpdatePromptTemplateBody from internal in orchestration, if that is wanted. Or we allow alias in internal? I am not sure about the style guide here.

deekshas8
deekshas8 previously approved these changes Jul 28, 2025
Copy link
Contributor

@deekshas8 deekshas8 left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@ZhongpinWang ZhongpinWang dismissed deekshas8’s stale review July 28, 2025 08:41

GitHub seems to have a bug preventing me merge the PR even when it is approved. Try dismissing the review.

@ZhongpinWang ZhongpinWang merged commit b41f5a5 into main Jul 28, 2025
11 checks passed
@ZhongpinWang ZhongpinWang deleted the replace-ts-to-zod-with-orval branch July 28, 2025 08:41
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.

2 participants