Skip to main content

makeFieldSchemaFromZod()

Home > @backstage/plugin-scaffolder > makeFieldSchemaFromZod

Utility function to convert zod return and UI options schemas to a CustomFieldExtensionSchema with FieldExtensionComponentProps type inference

Signature:

function makeFieldSchemaFromZod<TReturnSchema extends z.ZodType, TUiOptionsSchema extends z.ZodType = z.ZodType<any, any, {}>>(returnSchema: TReturnSchema, uiOptionsSchema?: TUiOptionsSchema): FieldSchema<TReturnSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : never, TUiOptionsSchema extends z.ZodType<any, any, infer IUiOptions> ? IUiOptions : never>;

Parameters

ParameterTypeDescription
returnSchemaTReturnSchema
uiOptionsSchemaTUiOptionsSchema(Optional)

Returns:

FieldSchema<TReturnSchema extends z.ZodType<any, any, infer IReturn> ? IReturn : never, TUiOptionsSchema extends z.ZodType<any, any, infer IUiOptions> ? IUiOptions : never>