Skip to content

Commit 66d3de1

Browse files
committed
make isDeprecated a stored property
1 parent 6bc272f commit 66d3de1

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

Sources/GraphQL/Type/Definition.swift

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ public final class GraphQLFieldDefinition {
497497
let args: [GraphQLArgumentDefinition]
498498
let resolve: GraphQLFieldResolve?
499499
let deprecationReason: String?
500+
let isDeprecated: Bool
500501

501502
init(
502503
name: String,
@@ -512,10 +513,7 @@ public final class GraphQLFieldDefinition {
512513
self.args = args
513514
self.resolve = resolve
514515
self.deprecationReason = deprecationReason
515-
}
516-
517-
var isDeprecated: Bool {
518-
return deprecationReason != nil
516+
self.isDeprecated = deprecationReason != nil
519517
}
520518

521519
func replaceTypeReferences(typeMap: TypeMap) throws {
@@ -902,6 +900,7 @@ func defineEnumValues(
902900
name: valueName,
903901
description: value.description,
904902
deprecationReason: value.deprecationReason,
903+
isDeprecated: value.deprecationReason != nil,
905904
value: value.value
906905
)
907906

@@ -933,11 +932,8 @@ struct GraphQLEnumValueDefinition {
933932
let name: String
934933
let description: String?
935934
let deprecationReason: String?
935+
let isDeprecated: Bool
936936
let value: Map
937-
938-
var isDeprecated: Bool {
939-
return deprecationReason != nil
940-
}
941937
}
942938

943939
extension GraphQLEnumValueDefinition : MapRepresentable {
@@ -1163,15 +1159,15 @@ extension GraphQLList : Hashable {
11631159
*/
11641160
public final class GraphQLNonNull {
11651161
public let ofType: GraphQLNullableType
1166-
1162+
11671163
public init(_ type: GraphQLNullableType) {
11681164
self.ofType = type
11691165
}
11701166

11711167
public init(_ name: String) {
11721168
self.ofType = GraphQLTypeReference(name)
11731169
}
1174-
1170+
11751171
var wrappedType: GraphQLType {
11761172
return ofType
11771173
}

0 commit comments

Comments
 (0)