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:382


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:394


vendor

static vendor: string = "zod"

Defined in

packages/zod/src/index.ts:72

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:322


getDiscriminatedUnionOptionName()

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

Parameters

option: undefined | ZodDiscriminatedUnionOption<any>

config?: TypeOrFieldConfig

Returns

undefined | string

Defined in

packages/zod/src/index.ts:310


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:331


getFieldConfig()

protected static getFieldConfig(schema): FieldConfig

Parameters

schema: ZodType<any, ZodTypeDef, any>

Returns

FieldConfig

Defined in

packages/zod/src/index.ts:358


getGraphQLType()

static getGraphQLType(schema): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:407


getGraphQLTypeBySelf()

static getGraphQLTypeBySelf(this): GraphQLOutputType

Parameters

this: ZodType<any, ZodTypeDef, any>

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:411


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:274


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:345


toGraphQLType()

static toGraphQLType(schema, config?): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

config?: TypeOrFieldConfig

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:115


toGraphQLTypePurely()

static toGraphQLTypePurely(schema, config?): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

config?: TypeOrFieldConfig

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:125


toNullableGraphQLType()

static toNullableGraphQLType(schema): GraphQLOutputType

Parameters

schema: ZodType<any, ZodTypeDef, any>

Returns

GraphQLOutputType

Defined in

packages/zod/src/index.ts:102


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:78


weave()

static weave(...inputs): GraphQLSchema

Weave a GraphQL Schema from resolvers with zod schema

Parameters

• ...inputs: (GraphQLSilk<any, any> | SilkResolver | WeaverConfig | SchemaWeaver | Middleware)[]

Resolvers, Global Middlewares, WeaverConfigs Or SchemaWeaver

Returns

GraphQLSchema

GraphQL Schema

Defined in

packages/zod/src/index.ts:98