Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/pothos/packages/core/builder.ts>SchemaBuilder

Pothos GraphQL is library for creating GraphQL schemas in typescript using a strongly typed code first approach
Latest
class SchemaBuilder
import { SchemaBuilder } from "https://deno.land/x/pothos@release-1730496474/packages/core/builder.ts";

Constructors

new
SchemaBuilder(options: PothosSchemaTypes.SchemaBuilderOptions<Types>)

Properties

$inferSchemaTypes: Types
configStore: ConfigStore<Types>
defaultFieldNullability: boolean
defaultInputFieldRequiredness: boolean
options: PothosSchemaTypes.SchemaBuilderOptions<Types>

Methods

addScalarType<Name extends ScalarName<Types>>(
name: Name,
...args: NormalizeArgs<[Omit<PothosSchemaTypes.ScalarTypeOptions<Types, InputShape<Types, Name>, OutputShape<Types, Name>>, "serialize"> & { serialize?: GraphQLScalarSerializer<OutputShape<Types, Name>>; }]>,
)
args<Shape extends InputFieldMap>(fields: (t: PothosSchemaTypes.InputFieldBuilder<Types, "Arg">) => Shape): Shape
enumType<Param extends EnumParam, Values extends EnumValues<Types>>(param: Param, options: EnumTypeOptions<Types, Param, Values>): PothosSchemaTypes.EnumRef<Types, Param extends BaseEnum ? ValuesFromEnum<Param> : ShapeFromEnumValues<Types, Values>>
inputRef<T extends object, Normalize = true>(name: string): ImplementableInputObjectRef<Types, RecursivelyNormalizeNullableFields<T>, Normalize extends false ? T : RecursivelyNormalizeNullableFields<T>>
inputType<Param extends InputObjectRef<Types, unknown> | string, Fields extends Param extends PothosSchemaTypes.InputObjectRef<Types, unknown> ? InputFieldsFromShape<Types, InputShape<Types, Param> & object, "InputObject"> : Param extends keyof Types["Inputs"] ? InputFieldsFromShape<Types, InputShape<Types, Param> & object, "InputObject"> : InputFieldMap>(param: Param, options: PothosSchemaTypes.InputObjectTypeOptions<Types, Fields>): PothosSchemaTypes.InputObjectRef<Types, InputShapeFromFields<Fields>>
interfaceField<Type extends InterfaceParam<Types>>(
ref: Type,
fieldName: string,
)
interfaceFields<Type extends InterfaceParam<Types>>(ref: Type, fields: InterfaceFieldsShape<Types, ParentShape<Types, Type>>)
interfaceType<Param extends InterfaceParam<Types>, Interfaces extends InterfaceParam<Types>[], ResolveType>(
param: Param,
options: InterfaceTypeOptions<Types, Param, ParentShape<Types, Param>, Interfaces, ResolveType>,
): PothosSchemaTypes.InterfaceRef<Types, AbstractReturnShape<Types, Param, ResolveType>, ParentShape<Types, Param>>
mutationField(name: string, field: MutationFieldThunk<Types>)
mutationType(...args: NormalizeArgs<[PothosSchemaTypes.MutationTypeOptions<Types>, MutationFieldsShape<Types>], 0>)
objectField<Type extends ObjectParam<Types>>(
param: Type,
fieldName: string,
)
objectFields<Type extends ObjectParam<Types>>(param: Type, fields: ObjectFieldsShape<Types, ParentShape<Types, Type>>)
objectRef<T>(name: string): ImplementableObjectRef<Types, T>
objectType<Interfaces extends InterfaceParam<Types>[], Param extends ObjectParam<Types>>(
param: Param,
options: ObjectTypeOptions<Types, Param, ParentShape<Types, Param>, Interfaces>,
): PothosSchemaTypes.ObjectRef<Types, OutputShape<Types, Param>, ParentShape<Types, Param>>
queryField(name: string, field: QueryFieldThunk<Types>)
queryType(...args: NormalizeArgs<[PothosSchemaTypes.QueryTypeOptions<Types>, QueryFieldsShape<Types>], 0>): QueryRef<Types>
scalarType<Name extends ScalarName<Types>>(name: Name, options: PothosSchemaTypes.ScalarTypeOptions<Types, InputShape<Types, Name>, ParentShape<Types, Name>>): PothosSchemaTypes.ScalarRef<Types, InputShape<Types, Name>, ParentShape<Types, Name>>
subscriptionType(...args: NormalizeArgs<[PothosSchemaTypes.SubscriptionTypeOptions<Types>, SubscriptionFieldsShape<Types>], 0>)
toSchema(...args: NormalizeArgs<[PothosSchemaTypes.BuildSchemaOptions<Types>]>)
unionType<Member extends ObjectParam<Types>, ResolveType>(name: string, options: PothosSchemaTypes.UnionTypeOptions<Types, Member, ResolveType>): PothosSchemaTypes.UnionRef<Types, AbstractReturnShape<Types, Member, ResolveType>, ParentShape<Types, Member>>

Static Properties

allowPluginReRegistration: boolean
optionNormalizers: Map<string, { v3?: (options: AddVersionedDefaultsToBuilderOptions<SchemaTypes, "v3">) => Partial<NormalizeSchemeBuilderOptions<SchemaTypes>>; v4?: undefined; }>