Class: ZodWeaver

Constructors

new ZodWeaver()

new ZodWeaver(): ZodWeaver

Returns

ZodWeaver

Properties

config()

static config: (config) => ZodWeaverConfig

Create a Zod weaver config object

Parameters

config: ZodWeaverConfigOptions

Zod weaver config options

Returns

ZodWeaverConfig

a Zod weaver config object

Defined in

packages/zod/src/index.ts:389


useConfig()

static useConfig: (config) => <TSchema>(schema) => TSchema & GraphQLSilk<output<TSchema>, input<TSchema>>

Use a Zod weaver config

Parameters

config: ZodWeaverConfigOptions

Zod weaver config options

Returns

Function

a new Zod to silk function

get GraphQL Silk from Zod Schema

Type Parameters

TSchema extends ZodType<any, ZodTypeDef, any>

Parameters

schema: TSchema

Zod Schema

Returns

TSchema & GraphQLSilk<output<TSchema>, input<TSchema>>

GraphQL Silk Like Zod Schema

Defined in

packages/zod/src/index.ts:401

Methods

ensureInterfaceType()

protected static ensureInterfaceType(item): GraphQLInterfaceType

Parameters

item: GraphQLInterfaceType | ZodObject<any, UnknownKeysParam, ZodTypeAny, object, object>

Returns

GraphQLInterfaceType

Defined in

packages/zod/src/index.ts:329


getDiscriminatedUnionOptionName()

static getDiscriminatedUnionOptionName(option, config?): undefined | string

Parameters

option: undefined | ZodDiscriminatedUnionOption<any>

config?: TypeOrFieldConfig

Returns

undefined | string

Defined in

packages/zod/src/index.ts:317


getEnumConfig()

protected static getEnumConfig(schema, config?): EnumConfig<string>

Parameters

schema: ZodEnum<any> | ZodNativeEnum<any>

config?: TypeOrFieldConfig

Returns

EnumConfig<string>

Defined in

packages/zod/src/index.ts:338


getFieldConfig()

protected static getFieldConfig(schema): FieldConfig

Parameters

schema: ZodType<any, ZodTypeDef, any>

Returns

FieldConfig

Defined in

packages/zod/src/index.ts:365


getObjectConfig()

protected static getObjectConfig(schema, config?): Partial<GraphQLObjectTypeConfig<any, any>>

Parameters

schema: ZodObject<any, UnknownKeysParam, ZodTypeAny, object, object>

config?: TypeOrFieldConfig

Returns

Partial<GraphQLObjectTypeConfig<any, any>>

Defined in

packages/zod/src/index.ts:281


getUnionConfig()

protected static getUnionConfig(schema, config?): Partial<GraphQLUnionTypeConfig<any, any>>

Parameters

schema: ZodUnion<any> | ZodDiscriminatedUnion<any, any>

config?: TypeOrFieldConfig

Returns

Partial<GraphQLUnionTypeConfig<any, any>>

Defined in

packages/zod/src/index.ts:352


toGraphQLType()

static toGraphQLType(schema, config?): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

config?: TypeOrFieldConfig

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:116


toGraphQLTypePurely()

static toGraphQLTypePurely(schema, config?): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

config?: TypeOrFieldConfig

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:126


toNullableGraphQLType()

static toNullableGraphQLType(schema): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:103


unravel()

static unravel<TSchema>(schema): TSchema & GraphQLSilk<output<TSchema>, input<TSchema>>

get GraphQL Silk from Zod Schema

Type Parameters

TSchema extends ZodType<any, ZodTypeDef, any>

Parameters

schema: TSchema

Zod Schema

Returns

TSchema & GraphQLSilk<output<TSchema>, input<TSchema>>

GraphQL Silk Like Zod Schema

Defined in

packages/zod/src/index.ts:83