{"version":3,"file":"literal.cjs","names":[],"sources":["../../../../src/utils/zod-to-json-schema/parsers/literal.ts"],"sourcesContent":["import { ZodLiteralDef } from \"zod/v3\";\nimport { Refs } from \"../Refs.js\";\n\nexport type JsonSchema7LiteralType =\n  | {\n      type: \"string\" | \"number\" | \"integer\" | \"boolean\";\n      const: string | number | boolean;\n    }\n  | {\n      type: \"object\" | \"array\";\n    };\n\nexport function parseLiteralDef(\n  def: ZodLiteralDef,\n  refs: Refs\n): JsonSchema7LiteralType {\n  const parsedType = typeof def.value;\n  if (\n    parsedType !== \"bigint\" &&\n    parsedType !== \"number\" &&\n    parsedType !== \"boolean\" &&\n    parsedType !== \"string\"\n  ) {\n    return {\n      type: Array.isArray(def.value) ? \"array\" : \"object\",\n    };\n  }\n\n  if (refs.target === \"openApi3\") {\n    return {\n      type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n      enum: [def.value],\n    } as any;\n  }\n\n  return {\n    type: parsedType === \"bigint\" ? \"integer\" : parsedType,\n    const: def.value,\n  };\n}\n"],"mappings":";AAYA,SAAgB,gBACd,KACA,MACwB;CACxB,MAAM,aAAa,OAAO,IAAI;AAC9B,KACE,eAAe,YACf,eAAe,YACf,eAAe,aACf,eAAe,SAEf,QAAO,EACL,MAAM,MAAM,QAAQ,IAAI,MAAM,GAAG,UAAU,UAC5C;AAGH,KAAI,KAAK,WAAW,WAClB,QAAO;EACL,MAAM,eAAe,WAAW,YAAY;EAC5C,MAAM,CAAC,IAAI,MAAM;EAClB;AAGH,QAAO;EACL,MAAM,eAAe,WAAW,YAAY;EAC5C,OAAO,IAAI;EACZ"}