1 | /**
|
2 | * Defines the functions exposed by OpenAPI-to-GraphQL.
|
3 | *
|
4 | * Some general notes:
|
5 | *
|
6 | * - GraphQL interfaces rely on sanitized strings for (input) object type names
|
7 | * and fields. We perform sanitization only when assigning (field-) names, but
|
8 | * keep keys in the OAS otherwise as-is, to ensure that inner-OAS references
|
9 | * work as expected.
|
10 | *
|
11 | * - GraphQL (input) object types must have a unique name. Thus, sometimes Input
|
12 | * object types and object types need separate names, despite them having the
|
13 | * same structure. We thus append 'Input' to every input object type's name
|
14 | * as a convention.
|
15 | *
|
16 | * - To pass data between resolve functions, OpenAPI-to-GraphQL uses a _openAPIToGraphQL object
|
17 | * returned by every resolver in addition to its original data (OpenAPI-to-GraphQL does
|
18 | * not use the context to do so, which is an anti-pattern according to
|
19 | * https://github.com/graphql/graphql-js/issues/953).
|
20 | *
|
21 | * - OpenAPI-to-GraphQL can handle basic authentication and API key-based authentication
|
22 | * through GraphQL. To do this, OpenAPI-to-GraphQL creates two new intermediate Object
|
23 | * Types called QueryViewer and MutationViewer that take as input security
|
24 | * credentials and pass them on using the _openAPIToGraphQL object to other resolve
|
25 | * functions.
|
26 | */
|
27 | import { Options, Report } from './types/options';
|
28 | import { Oas3 } from './types/oas3';
|
29 | import { Oas2 } from './types/oas2';
|
30 | import { GraphQLSchema } from 'graphql';
|
31 | declare type Result = {
|
32 | schema: GraphQLSchema;
|
33 | report: Report;
|
34 | };
|
35 | /**
|
36 | * Creates a GraphQL interface from the given OpenAPI Specification (2 or 3).
|
37 | */
|
38 | export declare function createGraphQLSchema<TSource, TContext, TArgs>(spec: Oas3 | Oas2 | (Oas3 | Oas2)[], options?: Options<TSource, TContext, TArgs>): Promise<Result>;
|
39 | export { sanitize, CaseStyle } from './oas_3_tools';
|
40 | export { GraphQLOperationType } from './types/graphql';
|