Skip to content

Commit 2d48fbb

Browse files
authored
Use specifiedBy instead of specifiedByUrl (#3032)
1 parent b9fd53b commit 2d48fbb

15 files changed

+58
-58
lines changed

docs/APIReference-TypeSystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ class GraphQLScalarType<InternalType> {
206206
type GraphQLScalarTypeConfig<InternalType> = {
207207
name: string;
208208
description?: ?string;
209-
specifiedByUrl?: string;
209+
specifiedByURL?: string;
210210
serialize: (value: mixed) => ?InternalType;
211211
parseValue?: (value: mixed) => ?InternalType;
212212
parseLiteral?: (valueAST: Value) => ?InternalType;

src/type/__tests__/definition-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,12 @@ describe('Type System: Scalars', () => {
4646
expect(() => new GraphQLScalarType({ name: 'SomeScalar' })).to.not.throw();
4747
});
4848

49-
it('accepts a Scalar type defining specifiedByUrl', () => {
49+
it('accepts a Scalar type defining specifiedByURL', () => {
5050
expect(
5151
() =>
5252
new GraphQLScalarType({
5353
name: 'SomeScalar',
54-
specifiedByUrl: 'https://example.com/foo_spec',
54+
specifiedByURL: 'https://example.com/foo_spec',
5555
}),
5656
).not.to.throw();
5757
});
@@ -139,16 +139,16 @@ describe('Type System: Scalars', () => {
139139
);
140140
});
141141

142-
it('rejects a Scalar type defining specifiedByUrl with an incorrect type', () => {
142+
it('rejects a Scalar type defining specifiedByURL with an incorrect type', () => {
143143
expect(
144144
() =>
145145
new GraphQLScalarType({
146146
name: 'SomeScalar',
147147
// $FlowExpectedError[incompatible-call]
148-
specifiedByUrl: {},
148+
specifiedByURL: {},
149149
}),
150150
).to.throw(
151-
'SomeScalar must provide "specifiedByUrl" as a string, but got: {}.',
151+
'SomeScalar must provide "specifiedByURL" as a string, but got: {}.',
152152
);
153153
});
154154
});

src/type/__tests__/introspection-test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('Introspection', () => {
3535
{
3636
kind: 'OBJECT',
3737
name: 'SomeObject',
38-
specifiedByUrl: null,
38+
specifiedByURL: null,
3939
fields: [
4040
{
4141
name: 'someField',
@@ -57,7 +57,7 @@ describe('Introspection', () => {
5757
{
5858
kind: 'SCALAR',
5959
name: 'String',
60-
specifiedByUrl: null,
60+
specifiedByURL: null,
6161
fields: null,
6262
inputFields: null,
6363
interfaces: null,
@@ -67,7 +67,7 @@ describe('Introspection', () => {
6767
{
6868
kind: 'SCALAR',
6969
name: 'Boolean',
70-
specifiedByUrl: null,
70+
specifiedByURL: null,
7171
fields: null,
7272
inputFields: null,
7373
interfaces: null,
@@ -77,7 +77,7 @@ describe('Introspection', () => {
7777
{
7878
kind: 'OBJECT',
7979
name: '__Schema',
80-
specifiedByUrl: null,
80+
specifiedByURL: null,
8181
fields: [
8282
{
8383
name: 'description',
@@ -182,7 +182,7 @@ describe('Introspection', () => {
182182
{
183183
kind: 'OBJECT',
184184
name: '__Type',
185-
specifiedByUrl: null,
185+
specifiedByURL: null,
186186
fields: [
187187
{
188188
name: 'kind',
@@ -222,7 +222,7 @@ describe('Introspection', () => {
222222
deprecationReason: null,
223223
},
224224
{
225-
name: 'specifiedByUrl',
225+
name: 'specifiedByURL',
226226
args: [],
227227
type: {
228228
kind: 'SCALAR',
@@ -377,7 +377,7 @@ describe('Introspection', () => {
377377
{
378378
kind: 'ENUM',
379379
name: '__TypeKind',
380-
specifiedByUrl: null,
380+
specifiedByURL: null,
381381
fields: null,
382382
inputFields: null,
383383
interfaces: null,
@@ -428,7 +428,7 @@ describe('Introspection', () => {
428428
{
429429
kind: 'OBJECT',
430430
name: '__Field',
431-
specifiedByUrl: null,
431+
specifiedByURL: null,
432432
fields: [
433433
{
434434
name: 'name',
@@ -539,7 +539,7 @@ describe('Introspection', () => {
539539
{
540540
kind: 'OBJECT',
541541
name: '__InputValue',
542-
specifiedByUrl: null,
542+
specifiedByURL: null,
543543
fields: [
544544
{
545545
name: 'name',
@@ -628,7 +628,7 @@ describe('Introspection', () => {
628628
{
629629
kind: 'OBJECT',
630630
name: '__EnumValue',
631-
specifiedByUrl: null,
631+
specifiedByURL: null,
632632
fields: [
633633
{
634634
name: 'name',
@@ -691,7 +691,7 @@ describe('Introspection', () => {
691691
{
692692
kind: 'OBJECT',
693693
name: '__Directive',
694-
specifiedByUrl: null,
694+
specifiedByURL: null,
695695
fields: [
696696
{
697697
name: 'name',
@@ -789,7 +789,7 @@ describe('Introspection', () => {
789789
{
790790
kind: 'ENUM',
791791
name: '__DirectiveLocation',
792-
specifiedByUrl: null,
792+
specifiedByURL: null,
793793
fields: null,
794794
inputFields: null,
795795
interfaces: null,

src/type/definition.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ export interface GraphQLScalarTypeExtensions {
304304
export class GraphQLScalarType {
305305
name: string;
306306
description: Maybe<string>;
307-
specifiedByUrl: Maybe<string>;
307+
specifiedByURL: Maybe<string>;
308308
serialize: GraphQLScalarSerializer<unknown>;
309309
parseValue: GraphQLScalarValueParser<unknown>;
310310
parseLiteral: GraphQLScalarLiteralParser<unknown>;
@@ -315,7 +315,7 @@ export class GraphQLScalarType {
315315
constructor(config: Readonly<GraphQLScalarTypeConfig<unknown, unknown>>);
316316

317317
toConfig(): GraphQLScalarTypeConfig<unknown, unknown> & {
318-
specifiedByUrl: Maybe<string>;
318+
specifiedByURL: Maybe<string>;
319319
serialize: GraphQLScalarSerializer<unknown>;
320320
parseValue: GraphQLScalarValueParser<unknown>;
321321
parseLiteral: GraphQLScalarLiteralParser<unknown>;
@@ -342,7 +342,7 @@ export type GraphQLScalarLiteralParser<TInternal> = (
342342
export interface GraphQLScalarTypeConfig<TInternal, TExternal> {
343343
name: string;
344344
description?: Maybe<string>;
345-
specifiedByUrl?: Maybe<string>;
345+
specifiedBy?: Maybe<string>;
346346
// Serializes an internal value to include in a response.
347347
serialize?: GraphQLScalarSerializer<TExternal>;
348348
// Parses an externally provided value to use as an input.

src/type/definition.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,7 @@ function resolveObjMapThunk<T>(thunk: ThunkObjMap<T>): ObjMap<T> {
549549
export class GraphQLScalarType {
550550
name: string;
551551
description: ?string;
552-
specifiedByUrl: ?string;
552+
specifiedByURL: ?string;
553553
serialize: GraphQLScalarSerializer<mixed>;
554554
parseValue: GraphQLScalarValueParser<mixed>;
555555
parseLiteral: GraphQLScalarLiteralParser<mixed>;
@@ -561,7 +561,7 @@ export class GraphQLScalarType {
561561
const parseValue = config.parseValue ?? identityFunc;
562562
this.name = config.name;
563563
this.description = config.description;
564-
this.specifiedByUrl = config.specifiedByUrl;
564+
this.specifiedByURL = config.specifiedByURL;
565565
this.serialize = config.serialize ?? identityFunc;
566566
this.parseValue = parseValue;
567567
this.parseLiteral =
@@ -574,10 +574,10 @@ export class GraphQLScalarType {
574574
devAssert(typeof config.name === 'string', 'Must provide name.');
575575

576576
devAssert(
577-
config.specifiedByUrl == null ||
578-
typeof config.specifiedByUrl === 'string',
579-
`${this.name} must provide "specifiedByUrl" as a string, ` +
580-
`but got: ${inspect(config.specifiedByUrl)}.`,
577+
config.specifiedByURL == null ||
578+
typeof config.specifiedByURL === 'string',
579+
`${this.name} must provide "specifiedByURL" as a string, ` +
580+
`but got: ${inspect(config.specifiedByURL)}.`,
581581
);
582582

583583
devAssert(
@@ -598,7 +598,7 @@ export class GraphQLScalarType {
598598
return {
599599
name: this.name,
600600
description: this.description,
601-
specifiedByUrl: this.specifiedByUrl,
601+
specifiedByURL: this.specifiedByURL,
602602
serialize: this.serialize,
603603
parseValue: this.parseValue,
604604
parseLiteral: this.parseLiteral,
@@ -638,7 +638,7 @@ export type GraphQLScalarLiteralParser<TInternal> = (
638638
export type GraphQLScalarTypeConfig<TInternal, TExternal> = {|
639639
name: string,
640640
description?: ?string,
641-
specifiedByUrl?: ?string,
641+
specifiedByURL?: ?string,
642642
// Serializes an internal value to include in a response.
643643
serialize?: GraphQLScalarSerializer<TExternal>,
644644
// Parses an externally provided value to use as an input.

src/type/introspection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ export const __DirectiveLocation: GraphQLEnumType = new GraphQLEnumType({
196196
export const __Type: GraphQLObjectType = new GraphQLObjectType({
197197
name: '__Type',
198198
description:
199-
'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByUrl`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.',
199+
'The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the `__TypeKind` enum.\n\nDepending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional `specifiedByURL`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.',
200200
fields: () =>
201201
({
202202
kind: {
@@ -241,10 +241,10 @@ export const __Type: GraphQLObjectType = new GraphQLObjectType({
241241
resolve: (type) =>
242242
type.description !== undefined ? type.description : undefined,
243243
},
244-
specifiedByUrl: {
244+
specifiedByURL: {
245245
type: GraphQLString,
246246
resolve: (obj) =>
247-
obj.specifiedByUrl !== undefined ? obj.specifiedByUrl : undefined,
247+
obj.specifiedByURL !== undefined ? obj.specifiedByURL : undefined,
248248
},
249249
fields: {
250250
type: new GraphQLList(new GraphQLNonNull(__Field)),

src/utilities/__tests__/buildASTSchema-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -707,7 +707,7 @@ describe('Schema Builder', () => {
707707
const schema = buildSchema(sdl);
708708

709709
expect(schema.getType('Foo')).to.include({
710-
specifiedByUrl: 'https://example.com/foo_spec',
710+
specifiedByURL: 'https://example.com/foo_spec',
711711
});
712712
});
713713

src/utilities/__tests__/extendSchema-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ describe('extendSchema', () => {
315315
const extendedSchema = extendSchema(schema, parse(extensionSDL));
316316
const foo = assertScalarType(extendedSchema.getType('Foo'));
317317

318-
expect(foo.specifiedByUrl).to.equal('https://example.com/foo_spec');
318+
expect(foo.specifiedByURL).to.equal('https://example.com/foo_spec');
319319

320320
expect(validateSchema(extendedSchema)).to.deep.equal([]);
321321
expectExtensionASTNodes(foo).to.equal(extensionSDL);

src/utilities/__tests__/getIntrospectionQuery-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,15 +63,15 @@ describe('getIntrospectionQuery', () => {
6363
}).toNotMatch('description');
6464
});
6565

66-
it('include "specifiedByUrl" field', () => {
67-
expectIntrospectionQuery().toNotMatch('specifiedByUrl');
66+
it('include "specifiedBy" field', () => {
67+
expectIntrospectionQuery().toNotMatch('specifiedByURL');
6868

6969
expectIntrospectionQuery({ specifiedByUrl: true }).toMatch(
70-
'specifiedByUrl',
70+
'specifiedByURL',
7171
);
7272

7373
expectIntrospectionQuery({ specifiedByUrl: false }).toNotMatch(
74-
'specifiedByUrl',
74+
'specifiedByURL',
7575
);
7676
});
7777

src/utilities/__tests__/printSchema-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -495,10 +495,10 @@ describe('Type System Printer', () => {
495495
`);
496496
});
497497

498-
it('Custom Scalar with specifiedByUrl', () => {
498+
it('Custom Scalar with specifiedByURL', () => {
499499
const FooType = new GraphQLScalarType({
500500
name: 'Foo',
501-
specifiedByUrl: 'https://example.com/foo_spec',
501+
specifiedByURL: 'https://example.com/foo_spec',
502502
});
503503

504504
const schema = new GraphQLSchema({ types: [FooType] });
@@ -670,13 +670,13 @@ describe('Type System Printer', () => {
670670
"""
671671
The fundamental unit of any GraphQL Schema is the type. There are many kinds of types in GraphQL as represented by the \`__TypeKind\` enum.
672672
673-
Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional \`specifiedByUrl\`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.
673+
Depending on the kind of a type, certain fields describe information about that type. Scalar types provide no information beyond a name, description and optional \`specifiedByURL\`, while Enum types provide their values. Object and Interface types provide the fields they describe. Abstract types, Union and Interface, provide the Object types possible at runtime. List and NonNull types compose other types.
674674
"""
675675
type __Type {
676676
kind: __TypeKind!
677677
name: String
678678
description: String
679-
specifiedByUrl: String
679+
specifiedByURL: String
680680
fields(includeDeprecated: Boolean = false): [__Field!]
681681
interfaces: [__Type!]
682682
possibleTypes: [__Type!]

src/utilities/buildClientSchema.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ export function buildClientSchema(
201201
return new GraphQLScalarType({
202202
name: scalarIntrospection.name,
203203
description: scalarIntrospection.description,
204-
specifiedByUrl: scalarIntrospection.specifiedByUrl,
204+
specifiedByURL: scalarIntrospection.specifiedByURL,
205205
});
206206
}
207207

src/utilities/extendSchema.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,14 @@ export function extendSchemaImpl(
310310
const config = type.toConfig();
311311
const extensions = typeExtensionsMap[config.name] ?? [];
312312

313-
let specifiedByUrl = config.specifiedByUrl;
313+
let specifiedByURL = config.specifiedByURL;
314314
for (const extensionNode of extensions) {
315-
specifiedByUrl = getSpecifiedByUrl(extensionNode) ?? specifiedByUrl;
315+
specifiedByURL = getSpecifiedByURL(extensionNode) ?? specifiedByURL;
316316
}
317317

318318
return new GraphQLScalarType({
319319
...config,
320-
specifiedByUrl,
320+
specifiedByURL,
321321
extensionASTNodes: config.extensionASTNodes.concat(extensions),
322322
});
323323
}
@@ -655,7 +655,7 @@ export function extendSchemaImpl(
655655
return new GraphQLScalarType({
656656
name,
657657
description: astNode.description?.value,
658-
specifiedByUrl: getSpecifiedByUrl(astNode),
658+
specifiedByURL: getSpecifiedByURL(astNode),
659659
astNode,
660660
extensionASTNodes,
661661
});
@@ -702,9 +702,9 @@ function getDeprecationReason(
702702
}
703703

704704
/**
705-
* Given a scalar node, returns the string value for the specifiedByUrl.
705+
* Given a scalar node, returns the string value for the specifiedByURL.
706706
*/
707-
function getSpecifiedByUrl(
707+
function getSpecifiedByURL(
708708
node: ScalarTypeDefinitionNode | ScalarTypeExtensionNode,
709709
): ?string {
710710
const specifiedBy = getDirectiveValues(GraphQLSpecifiedByDirective, node);

src/utilities/getIntrospectionQuery.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export interface IntrospectionOptions {
77
// Default: true
88
descriptions?: boolean;
99

10-
// Whether to include `specifiedByUrl` in the introspection result.
10+
// Whether to include `specifiedByURL` in the introspection result.
1111
// Default: false
1212
specifiedByUrl?: boolean;
1313

@@ -67,7 +67,7 @@ export interface IntrospectionScalarType {
6767
readonly kind: 'SCALAR';
6868
readonly name: string;
6969
readonly description?: Maybe<string>;
70-
readonly specifiedByUrl?: Maybe<string>;
70+
readonly specifiedByURL?: Maybe<string>;
7171
}
7272

7373
export interface IntrospectionObjectType {

0 commit comments

Comments
 (0)