import { extractSingleJsonSchema } from 'suretype' import { isSuretypeSchema, isTypeboxSchema } from './resolve-schema-lib.js' import { TJSONSchema } from './types.js' export function extractJsonSchema(libSchema: unknown): TJSONSchema | undefined { if (isTypeboxSchema(libSchema)) { return libSchema } if (isSuretypeSchema(libSchema)) { return extractSingleJsonSchema(libSchema)?.schema } return undefined }