@@ -9,11 +9,13 @@ import OrderedCollections
9
9
/// you may provide your own serialize, parseValue, and parseLiteral implementations.
10
10
open class Scalar < Resolver, Context, ScalarType: Codable > : TypeComponent < Resolver , Context > {
11
11
// TODO: Change this no longer be an open class
12
+ let specifiedByURL : String ?
12
13
13
14
override func update( typeProvider: SchemaTypeProvider , coders: Coders ) throws {
14
15
let scalarType = try GraphQLScalarType (
15
16
name: name,
16
17
description: description,
18
+ specifiedByURL: specifiedByURL,
17
19
serialize: { value in
18
20
if let serialize = self . serialize {
19
21
return try serialize ( value, coders)
@@ -70,10 +72,12 @@ open class Scalar<Resolver, Context, ScalarType: Codable>: TypeComponent<Resolve
70
72
init (
71
73
type _: ScalarType . Type ,
72
74
name: String ? ,
75
+ specifiedBy: String ? = nil ,
73
76
serialize: ( ( Any , Coders ) throws -> Map ) ? = nil ,
74
77
parseValue: ( ( Map , Coders ) throws -> Map ) ? = nil ,
75
78
parseLiteral: ( ( GraphQL . Value , Coders ) throws -> Map ) ? = nil
76
79
) {
80
+ specifiedByURL = specifiedBy
77
81
self . serialize = serialize
78
82
self . parseValue = parseValue
79
83
self . parseLiteral = parseLiteral
@@ -88,13 +92,15 @@ public extension Scalar {
88
92
convenience init (
89
93
_ type: ScalarType . Type ,
90
94
as name: String ? = nil ,
95
+ specifiedBy: String ? = nil ,
91
96
serialize: ( ( Any , Coders ) throws -> Map ) ? = nil ,
92
97
parseValue: ( ( Map , Coders ) throws -> Map ) ? = nil ,
93
98
parseLiteral: ( ( GraphQL . Value , Coders ) throws -> Map ) ? = nil
94
99
) {
95
100
self . init (
96
101
type: type,
97
102
name: name,
103
+ specifiedBy: specifiedBy,
98
104
serialize: serialize,
99
105
parseValue: parseValue,
100
106
parseLiteral: parseLiteral
0 commit comments