@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;
24 lines (23 loc) • 895 B
TypeScript
import type { GraphQLScalarType } from 'graphql';
import type { AnyTypeComposer } from 'graphql-compose';
import { SchemaComposer } from 'graphql-compose';
import type { JSONSchema } from 'json-machete';
import type { Logger } from '@graphql-mesh/types';
export interface TypeComposers {
input?: AnyTypeComposer<any>;
output: AnyTypeComposer<any> | SchemaComposer;
description?: string;
nullable?: boolean;
default?: any;
readOnly?: boolean;
writeOnly?: boolean;
flatten?: boolean;
deprecated?: boolean;
}
export interface GetComposerFromJSONSchemaOpts {
subgraphName: string;
schema: JSONSchema;
logger: Logger;
getScalarForFormat?: (format: string) => GraphQLScalarType | void;
}
export declare function getComposerFromJSONSchema({ subgraphName, schema, logger, getScalarForFormat, }: GetComposerFromJSONSchemaOpts): Promise<TypeComposers>;