Skip to content

Commit

Permalink
Add description support to scalar definition.
Browse files Browse the repository at this point in the history
  • Loading branch information
paulofaria committed Jun 28, 2020
1 parent b3b155a commit d7c943c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions Sources/Graphiti/Scalar.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ public final class Scalar<RootType : Keyable, Context, ScalarType : Codable> : C
override func update(builder: SchemaBuilder) throws {
let scalarType = try GraphQLScalarType(
name: name ?? Reflection.name(for: ScalarType.self),
description: description,
serialize: { value in
guard let scalarValue = value as? ScalarType else {
throw GraphQLError(message: "Serialize expected type \(ScalarType.self) but got \(type(of: value))")
Expand Down

0 comments on commit d7c943c

Please sign in to comment.