Skip to content

Commit a903d60

Browse files
committed
Remove uuidtools but keep validation logic
1 parent e07a760 commit a903d60

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

Gemfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ group :development, :test do
1919
gem 'webmock'
2020
gem 'zstandard'
2121
gem 'pry'
22-
gem 'uuidtools'
2322
end
2423

2524
group :docs do

LICENSE-3rdparty.csv

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ tomlrb,MIT,Francois Bernier
7171
typhoeus,MIT,"David Balatero, Paul Dix, Hans Hasselberg"
7272
tzinfo,MIT,Philip Ross
7373
unicode-display_width,MIT,Jan Lelis
74-
uuidtools,Apache-2.0,Bob Aman
7574
vcr,"Hippocratic-2.1,MIT","Myron Marston, Kurtis Rainbolt-Greene, Olle Jonsson"
7675
webmock,MIT,Bartosz Blimke
7776
with_env,MIT,Zach Dennis

datadog_api_client.gemspec

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Gem::Specification.new do |spec|
2626

2727
spec.add_runtime_dependency "zeitwerk", "~> 2.6", ">= 2.6.0"
2828

29-
spec.add_runtime_dependency "uuidtools", "~> 2.1.5", ">= 2.1.5"
30-
3129
spec.add_development_dependency "rspec", "~> 3.6", ">= 3.6.0"
3230

3331
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|cassettes)/}) }

lib/datadog_api_client/v2/model_base.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def _deserialize(type, value)
124124
# generic array, return directly
125125
value
126126
when :UUID
127-
value.to_s
127+
value
128128
when /\AArray<(?<inner_type>.+)>\z/
129129
inner_type = Regexp.last_match[:inner_type]
130130
value.map { |v| _deserialize(inner_type, v) }
@@ -255,7 +255,9 @@ def find_and_cast_into_type(klass, data)
255255
when 'Object' # "type: object"
256256
return data if data.instance_of?(Hash)
257257
when 'UUID'
258-
return UUIDTools::UUID.parse(data)
258+
raise TypeError, "Expected String, got #{uuid_string.class.name} instead." unless uuid_string.kind_of?(String)
259+
raise ArgumentError, "Invalid UUID format." unless /\A\h{8}-\h{4}-\h{4}-\h{4}-\h{12}\z/.match?(data)
260+
return data
259261
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
260262
if data.instance_of?(Array)
261263
sub_type = Regexp.last_match[:sub_type]

0 commit comments

Comments
 (0)