Skip to content
Merged
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
17 changes: 6 additions & 11 deletions src/utilities/printSchema.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {
GraphQLInputObjectType,
} from '../type/definition';
import { isIntrospectionType } from '../type/introspection';
import { GraphQLString, isSpecifiedScalarType } from '../type/scalars';
import { isSpecifiedScalarType } from '../type/scalars';
import {
DEFAULT_DEPRECATION_REASON,
isSpecifiedDirective,
Expand Down Expand Up @@ -282,9 +282,9 @@ function printDeprecated(reason: ?string): string {
if (reason == null) {
return '';
}
const reasonAST = astFromValue(reason, GraphQLString);
if (reasonAST && reason !== DEFAULT_DEPRECATION_REASON) {
return ' @deprecated(reason: ' + print(reasonAST) + ')';
if (reason !== DEFAULT_DEPRECATION_REASON) {
const astValue = print({ kind: 'StringValue', value: reason });
return ` @deprecated(reason: ${astValue})`;
}
return ' @deprecated';
}
Expand All @@ -293,13 +293,8 @@ function printSpecifiedByURL(scalar: GraphQLScalarType): string {
if (scalar.specifiedByURL == null) {
return '';
}
const url = scalar.specifiedByURL;
const urlAST = astFromValue(url, GraphQLString);
invariant(
urlAST,
'Unexpected null value returned from `astFromValue` for specifiedByURL',
);
return ' @specifiedBy(url: ' + print(urlAST) + ')';
const astValue = print({ kind: 'StringValue', value: scalar.specifiedByURL });
return ` @specifiedBy(url: ${astValue})`;
}

function printDescription(
Expand Down