Skip to content

Commit

Permalink
fix(framework): Specify zod-to-json-schema as a dependency (#6741)
Browse files Browse the repository at this point in the history
  • Loading branch information
rifont authored Oct 23, 2024
1 parent 504a409 commit ca3dddc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/framework/src/types/discover.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type DiscoverStepOutput = {
export type DiscoverWorkflowOutput = {
workflowId: string;
execute: Execute<Record<string, unknown>, Record<string, unknown>>;
/** @deprecated use top-level properties instead */
options: WorkflowOptions<Schema, Schema>;
code: string;
steps: Array<DiscoverStepOutput>;
Expand Down
4 changes: 3 additions & 1 deletion packages/framework/src/validators/zod.validator.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { ZodSchema } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';

import type { FromSchema, FromSchemaUnvalidated, JsonSchema, Schema } from '../types/schema.types';
import type { ValidateResult, Validator } from '../types/validator.types';
Expand Down Expand Up @@ -30,6 +29,9 @@ export class ZodValidator implements Validator<ZodSchema> {

transformToJsonSchema(schema: ZodSchema): JsonSchema {
try {
// eslint-disable-next-line global-require
const { zodToJsonSchema } = require('zod-to-json-schema') as typeof import('zod-to-json-schema');

// @ts-expect-error - zod-to-json-schema is not using JSONSchema7
return zodToJsonSchema(schema);
} catch (error) {
Expand Down

0 comments on commit ca3dddc

Please sign in to comment.