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;

17 lines (16 loc) 987 B
import { ObjectTypeComposer, type AnyTypeComposer, type ComposeInputType, type SchemaComposer, type UnionTypeComposer } from 'graphql-compose'; import type { Logger } from '@graphql-mesh/types'; import type { JSONSchemaObject } from '@json-schema-tools/meta-schema'; import type { TypeComposers } from './getComposerFromJSONSchema.js'; export interface GetUnionTypeComposersOpts { subgraphName: string; schemaComposer: SchemaComposer; typeComposersList: { input?: AnyTypeComposer<any>; output?: ObjectTypeComposer | UnionTypeComposer; }[]; subSchemaAndTypeComposers: JSONSchemaObject & TypeComposers; logger: Logger; } export declare function getContainerTC(subgraphName: string, schemaComposer: SchemaComposer, output: ComposeInputType): ObjectTypeComposer<any, any>; export declare function getUnionTypeComposers({ subgraphName, schemaComposer, typeComposersList, subSchemaAndTypeComposers, logger, }: GetUnionTypeComposersOpts): TypeComposers;