Skip to content

Commit 5a00b0f

Browse files
committed
Upgrade to dry-types 1.x
Have verified this works with the 0.x version of dry-types as well.
1 parent 6902255 commit 5a00b0f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

graphiti.gemspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
2020

2121
spec.add_dependency "jsonapi-serializable", "~> 0.3.0"
2222
spec.add_dependency "jsonapi-renderer", "0.2.0"
23-
spec.add_dependency "dry-types", "~> 0.15"
23+
spec.add_dependency "dry-types", ">= 0.15.0", "< 2.0"
2424
spec.add_dependency "graphiti_errors", "~> 1.1.0"
2525
spec.add_dependency "concurrent-ruby", "~> 1.0"
2626
spec.add_dependency "activesupport", ">= 4.1"

lib/graphiti/types.rb

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ def self.create(primitive, &blk)
1313
::DateTime.parse(input.to_s)
1414
end
1515
end
16-
input = Dry::Types["json.date_time"][input]
16+
input = Dry::Types["json.date_time"][input] if input.is_a?(::String)
1717
Dry::Types["strict.date_time"][input] if input
1818
}
1919

@@ -25,7 +25,8 @@ def self.create(primitive, &blk)
2525
::DateTime.parse(input.to_s)
2626
end
2727
end
28-
input = Dry::Types["json.date_time"][input]
28+
29+
input = Dry::Types["json.date_time"][input] if input.is_a?(::String)
2930
Dry::Types["strict.date_time"][input].iso8601 if input
3031
}
3132

@@ -36,13 +37,13 @@ def self.create(primitive, &blk)
3637

3738
Date = create(::Date) { |input|
3839
input = ::Date.parse(input.to_s) if input.is_a?(::Time)
39-
input = Dry::Types["json.date"][input]
40+
input = Dry::Types["json.date"][input] if input.is_a?(::String)
4041
Dry::Types["strict.date"][input] if input
4142
}
4243

4344
PresentDate = create(::Date) { |input|
4445
input = ::Date.parse(input.to_s) if input.is_a?(::Time)
45-
input = Dry::Types["json.date"][input]
46+
input = Dry::Types["json.date"][input] if input.is_a?(::String)
4647
Dry::Types["strict.date"][input]
4748
}
4849

0 commit comments

Comments
 (0)