@ephys/graphql-joi-directives
Version:
Adds Joi-powered constraint directive for GraphQL
12 lines (11 loc) • 607 B
TypeScript
import { GraphQLScalarType } from 'graphql';
import { SchemaDirectiveVisitorClass } from 'graphql-tools';
import type { Schema as JoiSchema } from 'joi';
export declare abstract class JoiConstrainedScalar extends GraphQLScalarType {
#private;
constructor(scalarType: GraphQLScalarType, args: any, fieldName: string);
abstract buildJoi(fieldName: string, args: {
[key: string]: any;
}, value: unknown): JoiSchema;
}
export declare function buildJoiDirective(tag: string, scalarType: GraphQLScalarType, ConstrainedScalarType: typeof JoiConstrainedScalar): SchemaDirectiveVisitorClass;