MCPcopy Create free account

hub / github.com/dmitryrechkin/json-schema-to-zod / functions

Functions35 in github.com/dmitryrechkin/json-schema-to-zod

↓ 31 callersMethodconvert
* Converts a JSON schema to a Zod schema. * * @param {JSONSchema} schema - The JSON schema. * @returns {ZodSchema} - The Zod schema.
src/JSONSchemaToZod.ts:12
↓ 12 callersMethodparseSchema
* Parses a JSON schema and returns the corresponding Zod schema. * This is the main entry point for schema conversion. * * @param {JSONSchema} s
src/JSONSchemaToZod.ts:225
↓ 4 callersMethodparseObject
* Parses an object schema. * * @param {JSONSchema} schema - The JSON schema for an object. * @returns {ZodTypeAny} - The ZodTypeAny schema.
src/JSONSchemaToZod.ts:668
↓ 4 callersMethodvalidateConditionalSchema
* Validates data against a conditional schema and adds issues to context if validation fails. * * @param {JSONValue} data - The data to validate.
src/JSONSchemaToZod.ts:88
↓ 2 callersMethodcreateUnionFromSchemas
* Creates a union from an array of schemas, handling special cases. * * @param {JSONSchema[]} schemas - Array of JSON schemas to create a union fr
src/JSONSchemaToZod.ts:885
↓ 2 callersMethodhandleSingleType
* Handles schemas with a single type. * * @param {JSONSchema} schema - The JSON schema with single type. * @returns {ZodTypeAny} - The ZodTypeAn
src/JSONSchemaToZod.ts:331
↓ 2 callersMethodmatchesCondition
* Checks if data matches a condition schema. * * @param {JSONValue} data - The data to check. * @param {JSONSchema} condition - The condition sc
src/JSONSchemaToZod.ts:24
↓ 2 callersMethodparseCombinator
* Parses a schema with combinators (oneOf, anyOf, allOf). * Delegates to the appropriate combinator parser based on which combinator is present. *
src/JSONSchemaToZod.ts:836
↓ 2 callersMethodprocessAdditionalProperties
* Processes additionalProperties configuration. * * @param {JSONSchema} schema - The JSON schema for an object. * @param {z.ZodObject<any, any>}
src/JSONSchemaToZod.ts:715
↓ 1 callersMethodapplyArrayConstraints
* Applies constraints to an array schema. * * @param {z.ZodArray<any>} arraySchema - The base array schema. * @param {JSONSchema} schema - The J
src/JSONSchemaToZod.ts:636
↓ 1 callersMethodapplyDefaultValues
* Applies default values from schema properties to data object. * * @param {JSONValue} data - The original data object. * @param {JSONSchema} sc
src/JSONSchemaToZod.ts:795
↓ 1 callersMethodapplyIntegerConstraint
* Applies integer constraint to a number schema if needed. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema}
src/JSONSchemaToZod.ts:468
↓ 1 callersMethodapplyNumberBounds
* Applies bounds validation to a number schema. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema} schema - T
src/JSONSchemaToZod.ts:392
↓ 1 callersMethodapplyNumberEnum
* Applies enum validation to a number schema. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema} schema - The
src/JSONSchemaToZod.ts:440
↓ 1 callersMethodapplyNumberMultipleOf
* Applies multipleOf validation to a number schema. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema} schema
src/JSONSchemaToZod.ts:420
↓ 1 callersMethodapplyStringEnum
* Applies enum validation to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema - The
src/JSONSchemaToZod.ts:590
↓ 1 callersMethodapplyStringFormat
* Applies format validation to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema - T
src/JSONSchemaToZod.ts:517
↓ 1 callersMethodapplyStringLength
* Applies length constraints to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema -
src/JSONSchemaToZod.ts:566
↓ 1 callersMethodapplyStringPattern
* Applies pattern validation to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema -
src/JSONSchemaToZod.ts:548
↓ 1 callersMethodcreateBaseObjectSchema
* Creates a base object schema from the given JSON schema. * * @param {JSONSchema} schema - The JSON schema. * @returns {z.ZodObject<any, any>}
src/JSONSchemaToZod.ts:773
↓ 1 callersMethodcreateUnionFromTypes
* Creates a union type from an array of types. * * @param {string[]} types - Array of type strings. * @param {JSONSchema} baseSchema - The base
src/JSONSchemaToZod.ts:314
↓ 1 callersMethodhandleNullableType
* Handles nullable types by creating a nullable schema. * * @param {JSONSchema} schema - The JSON schema with nullable type. * @returns {ZodType
src/JSONSchemaToZod.ts:284
↓ 1 callersMethodhandleTypeArray
* Handles schemas with an array of types. * * @param {JSONSchema} schema - The JSON schema with type array. * @returns {ZodTypeAny} - The ZodTyp
src/JSONSchemaToZod.ts:261
↓ 1 callersMethodmergeSchemas
* Merges two JSON schemas together. * * @param {JSONSchema} baseSchema - The base JSON schema. * @param {JSONSchema} addSchema - The JSON schema
src/JSONSchemaToZod.ts:964
↓ 1 callersMethodparseAllOf
* Parses an allOf combinator schema by merging all schemas. * * @param {JSONSchema[]} schemas - Array of JSON schemas in the allOf. * @returns {
src/JSONSchemaToZod.ts:935
↓ 1 callersMethodparseAnyOf
* Parses an anyOf combinator schema. * * @param {JSONSchema[]} schemas - Array of JSON schemas in the anyOf. * @returns {ZodTypeAny} - The ZodTy
src/JSONSchemaToZod.ts:874
↓ 1 callersMethodparseArray
* Parses a JSON schema of type array and returns the corresponding Zod schema. * * @param {JSONSchema} schema - The JSON schema. * @returns {Zod
src/JSONSchemaToZod.ts:609
↓ 1 callersMethodparseConditional
* Parses a conditional schema with if-then-else. * * @param {JSONSchema} schema - The JSON schema with conditional validation. * @returns {ZodTy
src/JSONSchemaToZod.ts:739
↓ 1 callersMethodparseNumberSchema
* Parses a number schema. * * @param {JSONSchema} schema - The JSON schema for a number. * @returns {ZodTypeAny} - The ZodTypeAny schema.
src/JSONSchemaToZod.ts:371
↓ 1 callersMethodparseOneOf
* Parses a oneOf combinator schema. * * @param {JSONSchema[]} schemas - Array of JSON schemas in the oneOf. * @returns {ZodTypeAny} - The ZodTyp
src/JSONSchemaToZod.ts:863
↓ 1 callersMethodparseString
* Parses a string schema. * * @param {JSONSchema} schema - The JSON schema for a string. * @returns {ZodTypeAny} - The ZodTypeAny schema.
src/JSONSchemaToZod.ts:487
↓ 1 callersMethodprocessObjectProperties
* Processes object properties and builds the shape object. * * @param {JSONSchema} schema - The JSON schema for an object. * @param {Record<stri
src/JSONSchemaToZod.ts:692
↓ 1 callersMethodvalidateNestedConditions
* Validates nested if-then-else conditions. * * @param {JSONValue} data - The data to validate. * @param {JSONSchema} schema - The schema contai
src/JSONSchemaToZod.ts:200
↓ 1 callersMethodvalidatePropertyPatterns
* Validates property patterns for string properties. * * @param {JSONValue} data - The data to validate. * @param {JSONSchema} schema - The sche
src/JSONSchemaToZod.ts:144
↓ 1 callersMethodvalidateRequiredProperties
* Validates that all required properties are present in the data. * * @param {JSONValue} data - The data to validate. * @param {JSONSchema} sche
src/JSONSchemaToZod.ts:102