UNPKG

@mastra/schema-compat

Version:

Tool schema compatibility layer for Mastra.ai

67 lines 2.4 kB
import type { JSONSchema7 } from '../_types/@types_json-schema/index.d.ts'; /** * Check if a JSON Schema represents an object type */ export declare function isObjectSchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema represents an array type */ export declare function isArraySchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema represents a string type */ export declare function isStringSchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema represents a number type (number or integer) */ export declare function isNumberSchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema uses anyOf */ export declare function isAnyOfSchema(schema: JSONSchema7): schema is JSONSchema7 & { anyOf: JSONSchema7[]; }; /** * Check if a JSON Schema uses oneOf */ export declare function isOneOfSchema(schema: JSONSchema7): schema is JSONSchema7 & { oneOf: JSONSchema7[]; }; /** * Check if a JSON Schema is a union type (anyOf or oneOf) */ export declare function isUnionSchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema is an enum type */ export declare function isEnumSchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema is a nullable type */ export declare function isNullableSchema(schema: JSONSchema7): boolean; /** * Check if a JSON Schema uses allOf (intersection) */ export declare function isAllOfSchema(schema: JSONSchema7): schema is JSONSchema7 & { allOf: JSONSchema7[]; }; /** * Check if a JSON Schema has number constraints (minimum, maximum, etc.) */ export declare function hasNumberConstraints(schema: JSONSchema7): boolean; /** * Check if a JSON Schema has string constraints (minLength, maxLength, pattern, format) */ export declare function hasStringConstraints(schema: JSONSchema7): boolean; /** * Check if a JSON Schema has array constraints (minItems, maxItems, uniqueItems) */ export declare function hasArrayConstraints(schema: JSONSchema7): boolean; /** * Check if a property is optional within a parent object schema. * A property is optional if it's not in the parent's `required` array. * @param propertyName - The name of the property to check * @param parentSchema - The parent object schema containing the property */ export declare function isOptionalSchema(propertyName: string, parentSchema: JSONSchema7): boolean; //# sourceMappingURL=utils.d.ts.map