apimatic_core 0.2.3 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +28 -15
- data/lib/apimatic-core/api_call.rb +0 -1
- data/lib/apimatic-core/configurations/global_configuration.rb +0 -14
- data/lib/apimatic-core/exceptions/any_of_validation_exception.rb +13 -0
- data/lib/apimatic-core/exceptions/one_of_validation_exception.rb +13 -0
- data/lib/apimatic-core/request_builder.rb +0 -26
- data/lib/apimatic-core/response_handler.rb +4 -19
- data/lib/apimatic-core/types/parameter.rb +11 -22
- data/lib/apimatic-core/types/union_types/any_of.rb +90 -0
- data/lib/apimatic-core/types/union_types/leaf_type.rb +298 -0
- data/lib/apimatic-core/types/union_types/one_of.rb +90 -0
- data/lib/apimatic-core/types/union_types/union_type_context.rb +30 -0
- data/lib/apimatic-core/utilities/api_helper.rb +60 -156
- data/lib/apimatic-core/utilities/date_time_helper.rb +54 -7
- data/lib/apimatic-core/utilities/union_type_helper.rb +298 -0
- data/lib/apimatic_core.rb +8 -0
- metadata +11 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c05d9bcfc3de9b4a1b64bef3e97ddc26be097d03a46c921526a7a0a0ab4ad083
|
4
|
+
data.tar.gz: aa0f7ae505663bc00d919cf4c8a9a661ce0ba2703cfa0aa1a82697aea5913472
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcfbdbab3adcf1d8c5463a2402e2cfa3253554a72ff4ddfe5625ababf23ff980ac4efb175d6959176bec6bf181f8554ae539181b7c8060c088ceff94c17ec1c7
|
7
|
+
data.tar.gz: 3a22ad6f9424b9a227020fc03f00a0b3d6537a7d3d11d2823d025fc0a4de8eb1b056c9e68af9b312f5809ff4ef6b7997d9921763befada28135962422e2a53f1
|
data/README.md
CHANGED
@@ -48,6 +48,14 @@ gem 'apimatic_core'
|
|
48
48
|
|------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------|
|
49
49
|
| [`GlobalConfiguration`](lib/apimatic-core/configurations/global_configuration.rb ) | Class holding the global configuration properties to make a successful API Call |
|
50
50
|
|
51
|
+
|
52
|
+
## Exceptions
|
53
|
+
| Name | Description |
|
54
|
+
|-------------------------------------------------------------------------------------------|-----------------------------------------------------|
|
55
|
+
| [`OneOfValidationException`](lib/apimatic-core/exceptions/one_of_validation_exception.rb) | Exception thrown in case of OneOf validation errors |
|
56
|
+
| [`AnyOfValidationException`](lib/apimatic-core/exceptions/any_of_validation_exception.rb) | Exception thrown in case of AnyOf validation errors |
|
57
|
+
|
58
|
+
|
51
59
|
## Factories
|
52
60
|
| Name | Description |
|
53
61
|
|-------------------------------------------------------------------------------|------------------------------------------|
|
@@ -67,23 +75,28 @@ gem 'apimatic_core'
|
|
67
75
|
| [`EndpointLogger`](lib/apimatic-core/logger/endpoint_logger.rb) | A class to provide logging for an API call |
|
68
76
|
|
69
77
|
## Types
|
70
|
-
| Name
|
71
|
-
|
72
|
-
| [`ApiException`](lib/apimatic-core/types/sdk/api_exception.rb)
|
73
|
-
| [`
|
74
|
-
| [`
|
75
|
-
| [`
|
76
|
-
| [`
|
77
|
-
| [`
|
78
|
+
| Name | Description |
|
79
|
+
|---------------------------------------------------------------------------------|-------------------------------------------------------------------------------|
|
80
|
+
| [`ApiException`](lib/apimatic-core/types/sdk/api_exception.rb) | Basic exception type for the SDK |
|
81
|
+
| [`AnyOf`](lib/apimatic-core/types/union_types/any_of.rb) | Represents the AnyOf union type |
|
82
|
+
| [`OneOf`](lib/apimatic-core/types/union_types/one_of.rb) | Represents the OneOf union type |
|
83
|
+
| [`LeafType`](lib/apimatic-core/types/union_types/leaf_type.rb) | Represents the LeafOf union type |
|
84
|
+
| [`UnionTypeContext`](lib/apimatic-core/types/union_types/union_type_context.rb) | Represents the context for a UnionType |
|
85
|
+
| [`ValidationException`](lib/apimatic-core/types/sdk/validation_exception.rb) | Exception thrown in case of validation error or failure |
|
86
|
+
| [`ErrorCase`](lib/apimatic-core/types/error_case.rb) | A class to represent Exception types |
|
87
|
+
| [`FileWrapper`](lib/apimatic-core/types/sdk/file_wrapper.rb) | A wrapper to allow passing in content type for file uploads |
|
88
|
+
| [`Parameter`](lib/apimatic-core/types/parameter.rb) | A class to represent information about a Parameter passed in an endpoint |
|
89
|
+
| [`XmlAttributes`](lib/apimatic-core/types/xml_attributes.rb) | A class to represent information about an XML Parameter passed in an endpoint |
|
78
90
|
|
79
91
|
## Utilities
|
80
|
-
| Name | Description
|
81
|
-
|
82
|
-
| [`ApiHelper`](lib/apimatic-core/utilities/api_helper.rb) | A Helper Class with various functions associated with making an API Call
|
83
|
-
| [`AuthHelper`](lib/apimatic-core/utilities/auth_helper.rb) | A Helper Class with various functions associated with authentication in API Calls
|
84
|
-
| [`
|
85
|
-
| [`
|
86
|
-
| [`
|
92
|
+
| Name | Description |
|
93
|
+
|------------------------------------------------------------------------|---------------------------------------------------------------------------------------|
|
94
|
+
| [`ApiHelper`](lib/apimatic-core/utilities/api_helper.rb) | A Helper Class with various functions associated with making an API Call |
|
95
|
+
| [`AuthHelper`](lib/apimatic-core/utilities/auth_helper.rb) | A Helper Class with various functions associated with authentication in API Calls |
|
96
|
+
| [`UnionTypeHelper`](lib/apimatic-core/utilities/union_type_helper.rb) | A Helper Class with various functions associated with Union type in API Calls |
|
97
|
+
| [`ComparisonHelper`](lib/apimatic-core/utilities/comparison_helper.rb) | A Helper Class used for the comparison of expected and actual API response |
|
98
|
+
| [`FileHelper`](lib/apimatic-core/utilities/file_helper.rb) | A Helper Class for files |
|
99
|
+
| [`XmlHelper`](lib/apimatic-core/utilities/xml_helper.rb ) | A Helper class that holds utility methods for xml serialization and deserialization. |
|
87
100
|
|
88
101
|
## Links
|
89
102
|
* [apimatic_core_interfaces](https://rubygems.org/gems/apimatic_core_interfaces)
|
@@ -86,7 +86,6 @@ module CoreLibrary
|
|
86
86
|
_deserialized_response = @response_handler.endpoint_logger(@endpoint_logger)
|
87
87
|
.endpoint_name_for_logging(@endpoint_name_for_logging)
|
88
88
|
.handle(_http_response, @global_configuration.get_global_errors,
|
89
|
-
@global_configuration.get_sdk_module,
|
90
89
|
@global_configuration.should_symbolize_hash)
|
91
90
|
_deserialized_response
|
92
91
|
rescue StandardError => e
|
@@ -12,7 +12,6 @@ module CoreLibrary
|
|
12
12
|
@additional_headers = {}
|
13
13
|
@auth_managers = {}
|
14
14
|
@base_uri_executor = nil
|
15
|
-
@sdk_module = nil
|
16
15
|
@symbolize_hash = false
|
17
16
|
end
|
18
17
|
|
@@ -30,19 +29,6 @@ module CoreLibrary
|
|
30
29
|
@global_errors
|
31
30
|
end
|
32
31
|
|
33
|
-
# Sets the current SDK module core library is being used for.
|
34
|
-
# @return [GlobalConfiguration] Current Instance.
|
35
|
-
def sdk_module(sdk_module)
|
36
|
-
@sdk_module = sdk_module
|
37
|
-
self
|
38
|
-
end
|
39
|
-
|
40
|
-
# Getter for the current SDK module the core library is being used for.
|
41
|
-
# @return [Module] Current SDK module.
|
42
|
-
def get_sdk_module
|
43
|
-
@sdk_module
|
44
|
-
end
|
45
|
-
|
46
32
|
# The setter for the global headers to be attached with all requests.
|
47
33
|
# @param [Hash] global_headers The hash of global headers.
|
48
34
|
# @return [GlobalConfiguration] An updated instance of GlobalConfiguration.
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CoreLibrary
|
2
|
+
# Custom exception class for AnyOfValidation
|
3
|
+
class AnyOfValidationException < StandardError
|
4
|
+
attr_reader :message
|
5
|
+
|
6
|
+
# Initializes a new instance of AnyOfValidationException with the specified message.
|
7
|
+
# @param [String] message The error message.
|
8
|
+
def initialize(message)
|
9
|
+
@message = message
|
10
|
+
super(message)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
module CoreLibrary
|
2
|
+
# Custom exception class for OneOfValidation
|
3
|
+
class OneOfValidationException < StandardError
|
4
|
+
attr_reader :message
|
5
|
+
|
6
|
+
# Initializes a new instance of OneOfValidationException with the specified message.
|
7
|
+
# @param [String] message The error message.
|
8
|
+
def initialize(message)
|
9
|
+
@message = message
|
10
|
+
super(message)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -14,14 +14,12 @@ module CoreLibrary
|
|
14
14
|
@additional_query_params = {}
|
15
15
|
@multipart_params = {}
|
16
16
|
@body_param = nil
|
17
|
-
@should_wrap_body_param = nil
|
18
17
|
@body_serializer = nil
|
19
18
|
@auth = nil
|
20
19
|
@array_serialization_format = ArraySerializationFormat::INDEXED
|
21
20
|
@xml_attributes = nil
|
22
21
|
@endpoint_name_for_logging = nil
|
23
22
|
@endpoint_logger = nil
|
24
|
-
@template_validation_array = []
|
25
23
|
end
|
26
24
|
|
27
25
|
# The setter for the server.
|
@@ -53,7 +51,6 @@ module CoreLibrary
|
|
53
51
|
# @return [RequestBuilder] An updated instance of RequestBuilder.
|
54
52
|
def template_param(template_param)
|
55
53
|
template_param.validate
|
56
|
-
conditional_add_to_template_validation_array(template_param)
|
57
54
|
@template_params[template_param.get_key] = { 'value' => template_param.get_value,
|
58
55
|
'encode' => template_param.need_to_encode }
|
59
56
|
self
|
@@ -64,7 +61,6 @@ module CoreLibrary
|
|
64
61
|
# @return [RequestBuilder] An updated instance of RequestBuilder.
|
65
62
|
def header_param(header_param)
|
66
63
|
header_param.validate
|
67
|
-
conditional_add_to_template_validation_array(header_param)
|
68
64
|
@header_params[header_param.get_key] = header_param.get_value
|
69
65
|
self
|
70
66
|
end
|
@@ -74,7 +70,6 @@ module CoreLibrary
|
|
74
70
|
# @return [RequestBuilder] An updated instance of RequestBuilder.
|
75
71
|
def query_param(query_param)
|
76
72
|
query_param.validate
|
77
|
-
conditional_add_to_template_validation_array(query_param)
|
78
73
|
@query_params[query_param.get_key] = query_param.get_value
|
79
74
|
self
|
80
75
|
end
|
@@ -84,7 +79,6 @@ module CoreLibrary
|
|
84
79
|
# @return [RequestBuilder] An updated instance of RequestBuilder.
|
85
80
|
def form_param(form_param)
|
86
81
|
form_param.validate
|
87
|
-
conditional_add_to_template_validation_array(form_param)
|
88
82
|
@form_params[form_param.get_key] = form_param.get_value
|
89
83
|
self
|
90
84
|
end
|
@@ -110,7 +104,6 @@ module CoreLibrary
|
|
110
104
|
# @return [RequestBuilder] An updated instance of RequestBuilder.
|
111
105
|
def multipart_param(multipart_param)
|
112
106
|
multipart_param.validate
|
113
|
-
conditional_add_to_template_validation_array(multipart_param)
|
114
107
|
@multipart_params[multipart_param.get_key] = get_part(multipart_param)
|
115
108
|
self
|
116
109
|
end
|
@@ -120,7 +113,6 @@ module CoreLibrary
|
|
120
113
|
# @return [RequestBuilder] An updated instance of RequestBuilder.
|
121
114
|
def body_param(body_param)
|
122
115
|
body_param.validate
|
123
|
-
conditional_add_to_template_validation_array(body_param)
|
124
116
|
if !body_param.get_key.nil?
|
125
117
|
@body_param = {} if @body_param.nil?
|
126
118
|
@body_param[body_param.get_key] = body_param.get_value
|
@@ -184,28 +176,10 @@ module CoreLibrary
|
|
184
176
|
self
|
185
177
|
end
|
186
178
|
|
187
|
-
# Add param to the template validation array, in case a template is provided.
|
188
|
-
def conditional_add_to_template_validation_array(parameter)
|
189
|
-
return if parameter.get_template.nil?
|
190
|
-
|
191
|
-
@template_validation_array.push(parameter)
|
192
|
-
end
|
193
|
-
|
194
|
-
# Validates the template for the params provided with a template.
|
195
|
-
def validate_templates
|
196
|
-
return if @template_validation_array.nil? || @template_validation_array.empty?
|
197
|
-
|
198
|
-
@template_validation_array.each do |parameter|
|
199
|
-
parameter.validate_template(@global_configuration.get_sdk_module,
|
200
|
-
@global_configuration.should_symbolize_hash)
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
179
|
# Builds the Http Request.
|
205
180
|
# @param [Hash] endpoint_context The endpoint configuration to be used while executing the request.
|
206
181
|
# @return [HttpRequest] An instance of HttpRequest.
|
207
182
|
def build(endpoint_context)
|
208
|
-
validate_templates
|
209
183
|
_url = process_url
|
210
184
|
_request_body = process_body
|
211
185
|
_request_headers = process_headers(@global_configuration)
|
@@ -18,7 +18,6 @@ module CoreLibrary
|
|
18
18
|
@is_date_response = false
|
19
19
|
@is_response_array = false
|
20
20
|
@is_response_void = false
|
21
|
-
@type_group = nil
|
22
21
|
end
|
23
22
|
|
24
23
|
# Sets deserializer for the response.
|
@@ -159,22 +158,12 @@ module CoreLibrary
|
|
159
158
|
end
|
160
159
|
# rubocop:enable Naming/PredicateName
|
161
160
|
|
162
|
-
# Sets type group for the response.
|
163
|
-
# @param [String] type_group The oneOf/anyOf type group template.
|
164
|
-
# @return [ResponseHandler] An updated instance of ResponseHandler.
|
165
|
-
def type_group(type_group)
|
166
|
-
@type_group = type_group
|
167
|
-
self
|
168
|
-
end
|
169
|
-
|
170
161
|
# Main method to handle the response with all the set properties.
|
171
162
|
# @param [HttpResponse] response The response received.
|
172
163
|
# @param [Hash] global_errors The global errors object.
|
173
|
-
# @param [Module] sdk_module The module of the SDK core library is being used for.
|
174
164
|
# @param [Boolean] should_symbolize_hash Flag to symbolize the hash during response deserialization.
|
175
165
|
# @return [Object] The deserialized response of the API Call.
|
176
|
-
|
177
|
-
def handle(response, global_errors, sdk_module, should_symbolize_hash = false)
|
166
|
+
def handle(response, global_errors, should_symbolize_hash = false)
|
178
167
|
@endpoint_logger.info("Validating response for #{@endpoint_name_for_logging}.")
|
179
168
|
|
180
169
|
# checking Nullify 404
|
@@ -189,7 +178,7 @@ module CoreLibrary
|
|
189
178
|
return if @is_response_void
|
190
179
|
|
191
180
|
# applying deserializer if configured
|
192
|
-
deserialized_value = apply_deserializer(response,
|
181
|
+
deserialized_value = apply_deserializer(response, should_symbolize_hash)
|
193
182
|
|
194
183
|
# applying api_response if configured
|
195
184
|
deserialized_value = apply_api_response(response, deserialized_value)
|
@@ -199,7 +188,6 @@ module CoreLibrary
|
|
199
188
|
|
200
189
|
deserialized_value
|
201
190
|
end
|
202
|
-
# rubocop:enable Style/OptionalBooleanParameter
|
203
191
|
|
204
192
|
# Validates the response provided and throws an error against the configured status code.
|
205
193
|
# @param [HttpResponse] response The received response.
|
@@ -224,15 +212,12 @@ module CoreLibrary
|
|
224
212
|
end
|
225
213
|
|
226
214
|
# Applies deserializer to the response.
|
227
|
-
# @param sdk_module Module of the SDK using the core library.
|
228
215
|
# @param [Boolean] should_symbolize_hash Flag to symbolize the hash during response deserialization.
|
229
|
-
def apply_deserializer(response,
|
216
|
+
def apply_deserializer(response, should_symbolize_hash)
|
230
217
|
return apply_xml_deserializer(response) if @is_xml_response
|
231
218
|
return response.raw_body if @deserializer.nil?
|
232
219
|
|
233
|
-
if
|
234
|
-
@deserializer.call(@type_group, response.raw_body, sdk_module, should_symbolize_hash)
|
235
|
-
elsif @datetime_format
|
220
|
+
if @datetime_format
|
236
221
|
@deserializer.call(response.raw_body, @datetime_format, @is_response_array, should_symbolize_hash)
|
237
222
|
elsif @is_date_response
|
238
223
|
@deserializer.call(response.raw_body, @is_response_array, should_symbolize_hash)
|
@@ -9,7 +9,7 @@ module CoreLibrary
|
|
9
9
|
@should_encode = false
|
10
10
|
@default_content_type = nil
|
11
11
|
@value_convertor = nil
|
12
|
-
@
|
12
|
+
@validator = nil
|
13
13
|
end
|
14
14
|
|
15
15
|
# The setter for the parameter key.
|
@@ -88,34 +88,23 @@ module CoreLibrary
|
|
88
88
|
@default_content_type
|
89
89
|
end
|
90
90
|
|
91
|
-
#
|
92
|
-
# @param [
|
93
|
-
# @return [Parameter] An updated instance of Parameter.
|
94
|
-
def
|
95
|
-
@
|
91
|
+
# Setter for the validator.
|
92
|
+
# @param validator [callable] The validator function to be set.
|
93
|
+
# @return [Parameter] An updated instance of the Parameter class.
|
94
|
+
def validator(validator)
|
95
|
+
@validator = validator
|
96
96
|
self
|
97
97
|
end
|
98
98
|
|
99
|
-
# Template getter in case a template is set.
|
100
|
-
# @return [Parameter] Returns template for the parameter.
|
101
|
-
def get_template
|
102
|
-
@template
|
103
|
-
end
|
104
|
-
|
105
99
|
# Validates the parameter value to be sent in the request.
|
106
|
-
# @raise [
|
100
|
+
# @raise [ArgumentError] If the parameter is required but the value is nil.
|
107
101
|
def validate
|
108
102
|
raise ArgumentError, "Required parameter #{@key} cannot be nil." if @is_required && @value.nil?
|
109
|
-
end
|
110
103
|
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
# rubocop:disable Style/OptionalBooleanParameter
|
116
|
-
def validate_template(sdk_module, should_symbolize_hash = false)
|
117
|
-
ApiHelper.validate_types(@value, @template, sdk_module, should_symbolize_hash) unless @value.nil?
|
104
|
+
return if @validator.nil?
|
105
|
+
|
106
|
+
validated_type = @validator.call(@value)
|
107
|
+
@value_convertor = proc { |value| validated_type.serialize(value) } if validated_type.is_valid
|
118
108
|
end
|
119
|
-
# rubocop:enable Style/OptionalBooleanParameter
|
120
109
|
end
|
121
110
|
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
module CoreLibrary
|
2
|
+
# Represents the AnyOf union type in the core library
|
3
|
+
class AnyOf < UnionType
|
4
|
+
# Initializes a new instance of AnyOf
|
5
|
+
# @param union_types [Array] The array of nested union types
|
6
|
+
# @param union_type_context [UnionTypeContext] The context for the union type
|
7
|
+
def initialize(union_types, union_type_context = UnionTypeContext.new)
|
8
|
+
super(union_types, union_type_context)
|
9
|
+
@collection_cases = nil
|
10
|
+
end
|
11
|
+
|
12
|
+
# Validates a value against the AnyOf union type
|
13
|
+
# @param value [Object] The value to validate
|
14
|
+
# @return [AnyOf] The validated AnyOf object
|
15
|
+
def validate(value)
|
16
|
+
context = @union_type_context
|
17
|
+
UnionTypeHelper.update_nested_flag_for_union_types(union_types)
|
18
|
+
is_optional_or_nullable = UnionTypeHelper.optional_or_nullable_case?(
|
19
|
+
context,
|
20
|
+
@union_types.map(&:union_type_context)
|
21
|
+
)
|
22
|
+
|
23
|
+
if value.nil? && is_optional_or_nullable
|
24
|
+
@is_valid = true
|
25
|
+
return self
|
26
|
+
end
|
27
|
+
|
28
|
+
if value.nil?
|
29
|
+
@is_valid = false
|
30
|
+
@error_messages = UnionTypeHelper.process_errors(value, @union_types, @error_messages,
|
31
|
+
union_type_context.is_nested, false)
|
32
|
+
end
|
33
|
+
|
34
|
+
validate_value_against_case(value, context)
|
35
|
+
|
36
|
+
unless @is_valid
|
37
|
+
@error_messages = UnionTypeHelper.process_errors(value, @union_types, @error_messages,
|
38
|
+
union_type_context.is_nested, false)
|
39
|
+
end
|
40
|
+
|
41
|
+
self
|
42
|
+
end
|
43
|
+
|
44
|
+
# Serializes a given value.
|
45
|
+
# @param value [Object] The value to be serialized.
|
46
|
+
# @return [Object, nil] The serialized representation of the value, or nil if the value is nil.
|
47
|
+
def serialize(value)
|
48
|
+
return nil if value.nil?
|
49
|
+
|
50
|
+
UnionTypeHelper.serialize_value(
|
51
|
+
value,
|
52
|
+
@union_type_context,
|
53
|
+
@collection_cases,
|
54
|
+
@union_types
|
55
|
+
)
|
56
|
+
end
|
57
|
+
|
58
|
+
# Deserializes a value based on the AnyOf union type
|
59
|
+
# @param value [Object] The value to deserialize
|
60
|
+
# @param should_symbolize [Boolean] Indicates whether the deserialized value should be symbolized.
|
61
|
+
# @return [Object, nil] The deserialized value, or nil if the input value is nil
|
62
|
+
def deserialize(value, should_symbolize: false)
|
63
|
+
return nil if value.nil?
|
64
|
+
|
65
|
+
UnionTypeHelper.deserialize_value(value, @union_type_context, @collection_cases,
|
66
|
+
@union_types, should_symbolize: should_symbolize)
|
67
|
+
end
|
68
|
+
|
69
|
+
private
|
70
|
+
|
71
|
+
# Validates a value against the appropriate case of the AnyOf union type
|
72
|
+
# @param value [Object] The value to validate
|
73
|
+
# @param context [UnionTypeContext] The context for the union type
|
74
|
+
def validate_value_against_case(value, context)
|
75
|
+
if context.is_array && context.is_dict && context.is_array_of_dict
|
76
|
+
@is_valid, @collection_cases = UnionTypeHelper.validate_array_of_dict_case(@union_types, value,
|
77
|
+
false)
|
78
|
+
elsif context.is_array && context.is_dict
|
79
|
+
@is_valid, @collection_cases = UnionTypeHelper.validate_dict_of_array_case(@union_types, value,
|
80
|
+
false)
|
81
|
+
elsif context.is_array
|
82
|
+
@is_valid, @collection_cases = UnionTypeHelper.validate_array_case(@union_types, value, false)
|
83
|
+
elsif context.is_dict
|
84
|
+
@is_valid, @collection_cases = UnionTypeHelper.validate_dict_case(@union_types, value, false)
|
85
|
+
else
|
86
|
+
@is_valid = UnionTypeHelper.get_matched_count(value, @union_types, false) >= 1
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|