UNPKG

@omnigraph/json-schema

Version:

This package generates GraphQL Schema from JSON Schema and sample JSON request and responses. You can define your root field endpoints like below in your GraphQL Config for example;

27 lines (26 loc) 1.2 kB
import { Logger } from '@graphql-mesh/types'; import { JSONSchemaObject } from '@json-schema-tools/meta-schema'; import Ajv from 'ajv'; import { AnyTypeComposer, ComposeInputType, InputTypeComposer, ObjectTypeComposer, SchemaComposer, UnionTypeComposer } from 'graphql-compose'; import { TypeComposers } from './getComposerFromJSONSchema'; export interface GetUnionTypeComposersOpts { schemaComposer: SchemaComposer; ajv: Ajv; typeComposersList: { input?: AnyTypeComposer<any>; output?: ObjectTypeComposer | UnionTypeComposer; }[]; subSchemaAndTypeComposers: JSONSchemaObject & TypeComposers; logger: Logger; } export declare function getContainerTC(schemaComposer: SchemaComposer, output: ComposeInputType): ObjectTypeComposer<any, any>; export declare function getUnionTypeComposers({ schemaComposer, ajv, typeComposersList, subSchemaAndTypeComposers, logger, }: GetUnionTypeComposersOpts): { input?: AnyTypeComposer<any>; output?: ObjectTypeComposer<any, any> | UnionTypeComposer<any, any>; } | { input: InputTypeComposer<any>; output: UnionTypeComposer<any, any>; nullable: boolean; readOnly: boolean; writeOnly: boolean; };