mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 14:27:04 +00:00
conform with structure of graphql-js in graphql typings
This commit is contained in:
Vendored
+21
@@ -61,6 +61,27 @@ export class GraphQLSchema {
|
||||
getDirective(name: string): GraphQLDirective;
|
||||
}
|
||||
|
||||
export type GraphQLSchemaValidationOptions = {
|
||||
/**
|
||||
* When building a schema from a GraphQL service's introspection result, it
|
||||
* might be safe to assume the schema is valid. Set to true to assume the
|
||||
* produced schema is valid.
|
||||
*
|
||||
* Default: false
|
||||
*/
|
||||
assumeValid?: boolean;
|
||||
|
||||
/**
|
||||
* If provided, the schema will consider fields or types with names included
|
||||
* in this list valid, even if they do not adhere to the specification's
|
||||
* schema validation rules.
|
||||
*
|
||||
* This option is provided to ease adoption and may be removed in a future
|
||||
* major release.
|
||||
*/
|
||||
allowedLegacyNames?: ReadonlyArray<string>;
|
||||
};
|
||||
|
||||
export interface GraphQLSchemaConfig {
|
||||
query: GraphQLObjectType;
|
||||
mutation?: GraphQLObjectType;
|
||||
|
||||
+21
-11
@@ -1,12 +1,17 @@
|
||||
import { DocumentNode, Location, StringValueNode } from '../language/ast';
|
||||
import { Source } from '../language/source';
|
||||
import { GraphQLSchema } from '../type/schema';
|
||||
import { GraphQLSchema, GraphQLSchemaValidationOptions } from '../type/schema';
|
||||
|
||||
type BuildSchemaOptions = {
|
||||
assumeValid?: boolean;
|
||||
allowedLegacyNames?: ReadonlyArray<string>;
|
||||
commentDescriptions?: boolean;
|
||||
};
|
||||
interface BuildSchemaOptions extends GraphQLSchemaValidationOptions {
|
||||
/**
|
||||
* Descriptions are defined as preceding string literals, however an older
|
||||
* experimental version of the SDL supported preceding comments as
|
||||
* descriptions. Set to true to enable this deprecated behavior.
|
||||
*
|
||||
* Default: false
|
||||
*/
|
||||
commentDescriptions?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* This takes the ast of a schema document produced by the parse function in
|
||||
@@ -21,13 +26,18 @@ type BuildSchemaOptions = {
|
||||
export function buildASTSchema(ast: DocumentNode): GraphQLSchema;
|
||||
|
||||
/**
|
||||
* Given an ast node, returns its string description based on a contiguous
|
||||
* block full-line of comments preceding it.
|
||||
* Given an ast node, returns its string description.
|
||||
*
|
||||
* Accepts options as a second argument:
|
||||
*
|
||||
* - commentDescriptions:
|
||||
* Provide true to use preceding comments as the description.
|
||||
*
|
||||
*/
|
||||
export function getDescription(
|
||||
node: { description?: StringValueNode; loc?: Location },
|
||||
options: BuildSchemaOptions
|
||||
): string;
|
||||
node: { description?: StringValueNode; loc?: Location },
|
||||
options: BuildSchemaOptions
|
||||
): string;
|
||||
|
||||
/**
|
||||
* A helper function to build a GraphQLSchema directly from a source
|
||||
|
||||
Reference in New Issue
Block a user