/**
 * JSON schema definition for JSON values (object, array, string, number, boolean, null).
 *
 * @example
 *   const MySchema = {
 *     type: "object",
 *     properties: {
 *       myJsonField: JSONTypeSchema,
 *     },
 *   }
 */
export const JSONTypeSchema = {
    anyOf: [
        { type: "object" },
        { type: "array" },
        { type: "string" },
        { type: "number" },
        { type: "boolean" },
        { type: "null" },
    ],
};
/**
 * Determines if a JSON schema property definition allows JSON values (object or array).
 *
 * Returns true if the definition's `type` is "object" or "array" (including arrays of types),
 * or if any `anyOf` subschemas specify `type: "object"` or `type: "array"`.
 * Used to identify columns that should be treated as JSON in the database layer.
 */
export function isJsonType(def) {
    // Handles type: "object" or "array", or anyOf: [{type:...}]
    if (def.type) {
        const types = Array.isArray(def.type) ? def.type : [def.type];
        if (types.includes("object") || types.includes("array"))
            return true;
    }
    if (Array.isArray(def.anyOf)) {
        if (def.anyOf.some((sub) => sub.type === "object" || sub.type === "array"))
            return true;
    }
    return false;
}
//# sourceMappingURL=json-type.js.map