Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/dmitryrechkin/json-schema-to-zod
/ functions
Functions
35 in github.com/dmitryrechkin/json-schema-to-zod
⨍
Functions
35
◇
Types & classes
2
↓ 31 callers
Method
convert
* Converts a JSON schema to a Zod schema. * * @param {JSONSchema} schema - The JSON schema. * @returns {ZodSchema} - The Zod schema.
src/JSONSchemaToZod.ts:12
↓ 12 callers
Method
parseSchema
* 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 callers
Method
parseObject
* Parses an object schema. * * @param {JSONSchema} schema - The JSON schema for an object. * @returns {ZodTypeAny} - The ZodTypeAny schema.
src/JSONSchemaToZod.ts:668
↓ 4 callers
Method
validateConditionalSchema
* 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 callers
Method
createUnionFromSchemas
* 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 callers
Method
handleSingleType
* Handles schemas with a single type. * * @param {JSONSchema} schema - The JSON schema with single type. * @returns {ZodTypeAny} - The ZodTypeAn
src/JSONSchemaToZod.ts:331
↓ 2 callers
Method
matchesCondition
* 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 callers
Method
parseCombinator
* 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 callers
Method
processAdditionalProperties
* Processes additionalProperties configuration. * * @param {JSONSchema} schema - The JSON schema for an object. * @param {z.ZodObject<any, any>}
src/JSONSchemaToZod.ts:715
↓ 1 callers
Method
applyArrayConstraints
* 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 callers
Method
applyDefaultValues
* Applies default values from schema properties to data object. * * @param {JSONValue} data - The original data object. * @param {JSONSchema} sc
src/JSONSchemaToZod.ts:795
↓ 1 callers
Method
applyIntegerConstraint
* Applies integer constraint to a number schema if needed. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema}
src/JSONSchemaToZod.ts:468
↓ 1 callers
Method
applyNumberBounds
* Applies bounds validation to a number schema. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema} schema - T
src/JSONSchemaToZod.ts:392
↓ 1 callers
Method
applyNumberEnum
* Applies enum validation to a number schema. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema} schema - The
src/JSONSchemaToZod.ts:440
↓ 1 callers
Method
applyNumberMultipleOf
* Applies multipleOf validation to a number schema. * * @param {z.ZodNumber} numberSchema - The base number schema. * @param {JSONSchema} schema
src/JSONSchemaToZod.ts:420
↓ 1 callers
Method
applyStringEnum
* Applies enum validation to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema - The
src/JSONSchemaToZod.ts:590
↓ 1 callers
Method
applyStringFormat
* Applies format validation to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema - T
src/JSONSchemaToZod.ts:517
↓ 1 callers
Method
applyStringLength
* Applies length constraints to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema -
src/JSONSchemaToZod.ts:566
↓ 1 callers
Method
applyStringPattern
* Applies pattern validation to a string schema. * * @param {z.ZodString} stringSchema - The base string schema. * @param {JSONSchema} schema -
src/JSONSchemaToZod.ts:548
↓ 1 callers
Method
createBaseObjectSchema
* 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 callers
Method
createUnionFromTypes
* 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 callers
Method
handleNullableType
* Handles nullable types by creating a nullable schema. * * @param {JSONSchema} schema - The JSON schema with nullable type. * @returns {ZodType
src/JSONSchemaToZod.ts:284
↓ 1 callers
Method
handleTypeArray
* 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 callers
Method
mergeSchemas
* Merges two JSON schemas together. * * @param {JSONSchema} baseSchema - The base JSON schema. * @param {JSONSchema} addSchema - The JSON schema
src/JSONSchemaToZod.ts:964
↓ 1 callers
Method
parseAllOf
* 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 callers
Method
parseAnyOf
* Parses an anyOf combinator schema. * * @param {JSONSchema[]} schemas - Array of JSON schemas in the anyOf. * @returns {ZodTypeAny} - The ZodTy
src/JSONSchemaToZod.ts:874
↓ 1 callers
Method
parseArray
* 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 callers
Method
parseConditional
* Parses a conditional schema with if-then-else. * * @param {JSONSchema} schema - The JSON schema with conditional validation. * @returns {ZodTy
src/JSONSchemaToZod.ts:739
↓ 1 callers
Method
parseNumberSchema
* Parses a number schema. * * @param {JSONSchema} schema - The JSON schema for a number. * @returns {ZodTypeAny} - The ZodTypeAny schema.
src/JSONSchemaToZod.ts:371
↓ 1 callers
Method
parseOneOf
* Parses a oneOf combinator schema. * * @param {JSONSchema[]} schemas - Array of JSON schemas in the oneOf. * @returns {ZodTypeAny} - The ZodTyp
src/JSONSchemaToZod.ts:863
↓ 1 callers
Method
parseString
* Parses a string schema. * * @param {JSONSchema} schema - The JSON schema for a string. * @returns {ZodTypeAny} - The ZodTypeAny schema.
src/JSONSchemaToZod.ts:487
↓ 1 callers
Method
processObjectProperties
* 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 callers
Method
validateNestedConditions
* Validates nested if-then-else conditions. * * @param {JSONValue} data - The data to validate. * @param {JSONSchema} schema - The schema contai
src/JSONSchemaToZod.ts:200
↓ 1 callers
Method
validatePropertyPatterns
* Validates property patterns for string properties. * * @param {JSONValue} data - The data to validate. * @param {JSONSchema} schema - The sche
src/JSONSchemaToZod.ts:144
↓ 1 callers
Method
validateRequiredProperties
* Validates that all required properties are present in the data. * * @param {JSONValue} data - The data to validate. * @param {JSONSchema} sche
src/JSONSchemaToZod.ts:102