kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
18 wiersze
470 B
TypeScript
18 wiersze
470 B
TypeScript
![]() |
import type { z } from 'zod'
|
||
|
import { zodToJsonSchema as zodToJsonSchemaImpl } from 'zod-to-json-schema'
|
||
|
|
||
![]() |
import type * as types from './types'
|
||
|
import { omit } from './utils'
|
||
![]() |
|
||
|
/** Generate a JSON Schema from a Zod schema. */
|
||
![]() |
export function zodToJsonSchema(schema: z.ZodType): types.JSONSchema {
|
||
![]() |
return omit(
|
||
|
zodToJsonSchemaImpl(schema, { $refStrategy: 'none' }),
|
||
|
'$schema',
|
||
|
'default',
|
||
|
'definitions',
|
||
|
'description',
|
||
![]() |
'markdownDescription'
|
||
![]() |
)
|
||
|
}
|