endoflife_date 0.10.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -4,9 +4,9 @@
4
4
  #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
5
5
 
6
6
  The version of the OpenAPI document: 0.0.1
7
- Contact: blah@cliffano.com
7
+ Contact: blah+oapicf@cliffano.com
8
8
  Generated by: https://openapi-generator.tech
9
- OpenAPI Generator version: 7.0.0
9
+ Generator version: 7.4.0
10
10
 
11
11
  =end
12
12
 
@@ -16,13 +16,11 @@ require 'time'
16
16
  module EndOfLifeDateApiClient
17
17
  # Details of a single release cycle of a given product. There might be some slight variations to this depending on the product.
18
18
  class Cycle
19
- # Release Cycle
20
19
  attr_accessor :cycle
21
20
 
22
21
  # Release Date for the first release in this cycle
23
22
  attr_accessor :release_date
24
23
 
25
- # End of Life Date for this release cycle
26
24
  attr_accessor :eol
27
25
 
28
26
  # Latest release in this cycle
@@ -31,13 +29,10 @@ module EndOfLifeDateApiClient
31
29
  # Link to changelog for the latest release, if available
32
30
  attr_accessor :link
33
31
 
34
- # Whether this release cycle has long-term-support (LTS). Can be a date instead in YYYY-MM-DD format as well if the release enters LTS status on a given date.
35
32
  attr_accessor :lts
36
33
 
37
- # Whether this release cycle has active support
38
34
  attr_accessor :support
39
35
 
40
- # Whether this cycle is now discontinued.
41
36
  attr_accessor :discontinued
42
37
 
43
38
  # Attribute mapping from ruby-style variable name to JSON key.
@@ -62,28 +57,21 @@ module EndOfLifeDateApiClient
62
57
  # Attribute type mapping.
63
58
  def self.openapi_types
64
59
  {
65
- :'cycle' => :'Object',
66
- :'release_date' => :'Object',
67
- :'eol' => :'Object',
68
- :'latest' => :'Object',
69
- :'link' => :'Object',
70
- :'lts' => :'Object',
71
- :'support' => :'Object',
72
- :'discontinued' => :'Object'
60
+ :'cycle' => :'CycleCycle',
61
+ :'release_date' => :'Date',
62
+ :'eol' => :'CycleEol',
63
+ :'latest' => :'String',
64
+ :'link' => :'String',
65
+ :'lts' => :'CycleLts',
66
+ :'support' => :'CycleSupport',
67
+ :'discontinued' => :'CycleDiscontinued'
73
68
  }
74
69
  end
75
70
 
76
71
  # List of attributes with nullable: true
77
72
  def self.openapi_nullable
78
73
  Set.new([
79
- :'cycle',
80
- :'release_date',
81
- :'eol',
82
- :'latest',
83
74
  :'link',
84
- :'lts',
85
- :'support',
86
- :'discontinued'
87
75
  ])
88
76
  end
89
77
 
@@ -148,10 +136,6 @@ module EndOfLifeDateApiClient
148
136
  invalid_properties.push('invalid value for "release_date", the character length must be great than or equal to 10.')
149
137
  end
150
138
 
151
- if !@eol.nil? && @eol.to_s.length < 1
152
- invalid_properties.push('invalid value for "eol", the character length must be great than or equal to 1.')
153
- end
154
-
155
139
  if !@latest.nil? && @latest.to_s.length < 1
156
140
  invalid_properties.push('invalid value for "latest", the character length must be great than or equal to 1.')
157
141
  end
@@ -160,22 +144,6 @@ module EndOfLifeDateApiClient
160
144
  invalid_properties.push('invalid value for "link", the character length must be great than or equal to 1.')
161
145
  end
162
146
 
163
- if !@support.nil? && @support.to_s.length > 10
164
- invalid_properties.push('invalid value for "support", the character length must be smaller than or equal to 10.')
165
- end
166
-
167
- if !@support.nil? && @support.to_s.length < 10
168
- invalid_properties.push('invalid value for "support", the character length must be great than or equal to 10.')
169
- end
170
-
171
- if !@discontinued.nil? && @discontinued.to_s.length > 10
172
- invalid_properties.push('invalid value for "discontinued", the character length must be smaller than or equal to 10.')
173
- end
174
-
175
- if !@discontinued.nil? && @discontinued.to_s.length < 10
176
- invalid_properties.push('invalid value for "discontinued", the character length must be great than or equal to 10.')
177
- end
178
-
179
147
  invalid_properties
180
148
  end
181
149
 
@@ -185,44 +153,37 @@ module EndOfLifeDateApiClient
185
153
  warn '[DEPRECATED] the `valid?` method is obsolete'
186
154
  return false if !@release_date.nil? && @release_date.to_s.length > 10
187
155
  return false if !@release_date.nil? && @release_date.to_s.length < 10
188
- return false if !@eol.nil? && @eol.to_s.length < 1
189
156
  return false if !@latest.nil? && @latest.to_s.length < 1
190
157
  return false if !@link.nil? && @link.to_s.length < 1
191
- return false if !@support.nil? && @support.to_s.length > 10
192
- return false if !@support.nil? && @support.to_s.length < 10
193
- return false if !@discontinued.nil? && @discontinued.to_s.length > 10
194
- return false if !@discontinued.nil? && @discontinued.to_s.length < 10
195
158
  true
196
159
  end
197
160
 
198
161
  # Custom attribute writer method with validation
199
162
  # @param [Object] release_date Value to be assigned
200
163
  def release_date=(release_date)
201
- if !release_date.nil? && release_date.to_s.length > 10
164
+ if release_date.nil?
165
+ fail ArgumentError, 'release_date cannot be nil'
166
+ end
167
+
168
+ if release_date.to_s.length > 10
202
169
  fail ArgumentError, 'invalid value for "release_date", the character length must be smaller than or equal to 10.'
203
170
  end
204
171
 
205
- if !release_date.nil? && release_date.to_s.length < 10
172
+ if release_date.to_s.length < 10
206
173
  fail ArgumentError, 'invalid value for "release_date", the character length must be great than or equal to 10.'
207
174
  end
208
175
 
209
176
  @release_date = release_date
210
177
  end
211
178
 
212
- # Custom attribute writer method with validation
213
- # @param [Object] eol Value to be assigned
214
- def eol=(eol)
215
- if !eol.nil? && eol.to_s.length < 1
216
- fail ArgumentError, 'invalid value for "eol", the character length must be great than or equal to 1.'
217
- end
218
-
219
- @eol = eol
220
- end
221
-
222
179
  # Custom attribute writer method with validation
223
180
  # @param [Object] latest Value to be assigned
224
181
  def latest=(latest)
225
- if !latest.nil? && latest.to_s.length < 1
182
+ if latest.nil?
183
+ fail ArgumentError, 'latest cannot be nil'
184
+ end
185
+
186
+ if latest.to_s.length < 1
226
187
  fail ArgumentError, 'invalid value for "latest", the character length must be great than or equal to 1.'
227
188
  end
228
189
 
@@ -239,34 +200,6 @@ module EndOfLifeDateApiClient
239
200
  @link = link
240
201
  end
241
202
 
242
- # Custom attribute writer method with validation
243
- # @param [Object] support Value to be assigned
244
- def support=(support)
245
- if !support.nil? && support.to_s.length > 10
246
- fail ArgumentError, 'invalid value for "support", the character length must be smaller than or equal to 10.'
247
- end
248
-
249
- if !support.nil? && support.to_s.length < 10
250
- fail ArgumentError, 'invalid value for "support", the character length must be great than or equal to 10.'
251
- end
252
-
253
- @support = support
254
- end
255
-
256
- # Custom attribute writer method with validation
257
- # @param [Object] discontinued Value to be assigned
258
- def discontinued=(discontinued)
259
- if !discontinued.nil? && discontinued.to_s.length > 10
260
- fail ArgumentError, 'invalid value for "discontinued", the character length must be smaller than or equal to 10.'
261
- end
262
-
263
- if !discontinued.nil? && discontinued.to_s.length < 10
264
- fail ArgumentError, 'invalid value for "discontinued", the character length must be great than or equal to 10.'
265
- end
266
-
267
- @discontinued = discontinued
268
- end
269
-
270
203
  # Checks equality by comparing each attribute.
271
204
  # @param [Object] Object to be compared
272
205
  def ==(o)
@@ -356,7 +289,7 @@ module EndOfLifeDateApiClient
356
289
  else # model
357
290
  # models (e.g. Pet) or oneOf
358
291
  klass = EndOfLifeDateApiClient.const_get(type)
359
- klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
292
+ klass.respond_to?(:openapi_any_of) || klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
360
293
  end
361
294
  end
362
295
 
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #endoflife.date
3
+
4
+ #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
5
+
6
+ The version of the OpenAPI document: 0.0.1
7
+ Contact: blah+oapicf@cliffano.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module EndOfLifeDateApiClient
17
+ # Release Cycle
18
+ module CycleCycle
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Float',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = EndOfLifeDateApiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #endoflife.date
3
+
4
+ #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
5
+
6
+ The version of the OpenAPI document: 0.0.1
7
+ Contact: blah+oapicf@cliffano.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module EndOfLifeDateApiClient
17
+ # Whether this cycle is now discontinued.
18
+ module CycleDiscontinued
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Boolean',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = EndOfLifeDateApiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #endoflife.date
3
+
4
+ #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
5
+
6
+ The version of the OpenAPI document: 0.0.1
7
+ Contact: blah+oapicf@cliffano.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module EndOfLifeDateApiClient
17
+ # End of Life Date for this release cycle
18
+ module CycleEol
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Boolean',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = EndOfLifeDateApiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end
@@ -0,0 +1,105 @@
1
+ =begin
2
+ #endoflife.date
3
+
4
+ #Documentation for the endoflife.date API. The API is currently in Alpha. Additional information about the API can be found on the [endoflife.date wiki](https://github.com/endoflife-date/endoflife.date/wiki)
5
+
6
+ The version of the OpenAPI document: 0.0.1
7
+ Contact: blah+oapicf@cliffano.com
8
+ Generated by: https://openapi-generator.tech
9
+ Generator version: 7.4.0
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module EndOfLifeDateApiClient
17
+ # Whether this release cycle has long-term-support (LTS). Can be a date instead in YYYY-MM-DD format as well if the release enters LTS status on a given date.
18
+ module CycleLts
19
+ class << self
20
+ # List of class defined in anyOf (OpenAPI v3)
21
+ def openapi_any_of
22
+ [
23
+ :'Boolean',
24
+ :'String'
25
+ ]
26
+ end
27
+
28
+ # Builds the object
29
+ # @param [Mixed] Data to be matched against the list of anyOf items
30
+ # @return [Object] Returns the model or the data itself
31
+ def build(data)
32
+ # Go through the list of anyOf items and attempt to identify the appropriate one.
33
+ # Note:
34
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
35
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
36
+ # - TODO: scalar values are de facto behaving as if they were nullable.
37
+ # - TODO: logging when debugging is set.
38
+ openapi_any_of.each do |klass|
39
+ begin
40
+ next if klass == :AnyType # "nullable: true"
41
+ typed_data = find_and_cast_into_type(klass, data)
42
+ return typed_data if typed_data
43
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
44
+ end
45
+ end
46
+
47
+ openapi_any_of.include?(:AnyType) ? data : nil
48
+ end
49
+
50
+ private
51
+
52
+ SchemaMismatchError = Class.new(StandardError)
53
+
54
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
55
+ def find_and_cast_into_type(klass, data)
56
+ return if data.nil?
57
+
58
+ case klass.to_s
59
+ when 'Boolean'
60
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
61
+ when 'Float'
62
+ return data if data.instance_of?(Float)
63
+ when 'Integer'
64
+ return data if data.instance_of?(Integer)
65
+ when 'Time'
66
+ return Time.parse(data)
67
+ when 'Date'
68
+ return Date.parse(data)
69
+ when 'String'
70
+ return data if data.instance_of?(String)
71
+ when 'Object' # "type: object"
72
+ return data if data.instance_of?(Hash)
73
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
74
+ if data.instance_of?(Array)
75
+ sub_type = Regexp.last_match[:sub_type]
76
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
77
+ end
78
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
79
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
80
+ sub_type = Regexp.last_match[:sub_type]
81
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
82
+ end
83
+ else # model
84
+ const = EndOfLifeDateApiClient.const_get(klass)
85
+ if const
86
+ if const.respond_to?(:openapi_any_of) # nested anyOf model
87
+ model = const.build(data)
88
+ return model if model
89
+ else
90
+ # raise if data contains keys that are not known to the model
91
+ raise if const.respond_to?(:acceptable_attributes) && !(data.keys - const.acceptable_attributes).empty?
92
+ model = const.build_from_hash(data)
93
+ return model if model
94
+ end
95
+ end
96
+ end
97
+
98
+ raise # if no match by now, raise
99
+ rescue
100
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
101
+ end
102
+ end
103
+ end
104
+
105
+ end