graphql-validate-directive
Version:
A GraphQL directive for input validation
23 lines (22 loc) • 1.35 kB
TypeScript
import type { AsyncSchema, JSONSchemaType } from 'ajv';
import Ajv from 'ajv';
import { GraphQLArgument, GraphQLField, GraphQLInputType, GraphQLList, GraphQLNamedType, GraphQLObjectType, GraphQLScalarType, GraphQLSchema } from 'graphql';
import type { Maybe } from 'graphql/jsutils/Maybe';
import type { ValidateOptions } from './type';
export declare class GraphQLValidateDirective {
schema: GraphQLSchema;
directiveName: string;
ajv: Ajv;
constructor(schema: GraphQLSchema, directiveName?: string, ajv?: Ajv);
getScalerTypeSchema(type: GraphQLScalarType, opt: ValidateOptions): JSONSchemaType<any>;
getListTypeSchema(type: GraphQLList<GraphQLInputType>, opt: ValidateOptions): JSONSchemaType<any[]>;
getInputTypeSchema(type: GraphQLInputType, opt?: ValidateOptions): JSONSchemaType<any>;
getInputTypeRefName(name: string): string;
getTypeSchema(type: GraphQLNamedType): JSONSchemaType<Record<string, any>> | undefined;
registerTypeSchemas(typeMap: Record<string, GraphQLNamedType>): void;
getArgsSchema(args: readonly GraphQLArgument[]): AsyncSchema;
createValidator(args: readonly GraphQLArgument[]): import("ajv").AsyncValidateFunction<unknown>;
composeResolverForField(field: GraphQLField<any, any>): void;
composeResolver(type: Maybe<GraphQLObjectType>): void;
transformSchema(): void;
}