Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring back getDescription export #1165

Merged
merged 1 commit into from
Dec 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,8 @@ export {
buildASTSchema,
// Build a GraphQLSchema from a GraphQL schema language document.
buildSchema,
// Get the description from a schema AST node.
getDescription,
// Extends an existing GraphQLSchema from a parsed GraphQL Schema
// language AST.
extendSchema,
Expand Down
7 changes: 6 additions & 1 deletion src/utilities/buildASTSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import type {
EnumValueDefinitionNode,
InputObjectTypeDefinitionNode,
DirectiveDefinitionNode,
StringValueNode,
Location,
} from '../language/ast';

import type { DirectiveLocationEnum } from '../language/directiveLocation';
Expand Down Expand Up @@ -475,7 +477,10 @@ function getDeprecationReason(
* Provide true to use preceding comments as the description.
*
*/
function getDescription(node, options: ?Options): void | string {
export function getDescription(
node: { +description?: StringValueNode, +loc?: Location },
options: ?Options,
): void | string {
if (node.description) {
return node.description.value;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utilities/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export { getOperationAST } from './getOperationAST';
export { buildClientSchema } from './buildClientSchema';

// Build a GraphQLSchema from GraphQL Schema language.
export { buildASTSchema, buildSchema } from './buildASTSchema';
export { buildASTSchema, buildSchema, getDescription } from './buildASTSchema';

// Extends an existing GraphQLSchema from a parsed GraphQL Schema language AST.
export { extendSchema } from './extendSchema';
Expand Down