algolia 3.0.0.beta.1 → 3.0.0.beta.2
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/CHANGELOG.md +5 -0
- data/Gemfile.lock +6 -6
- data/lib/algolia/models/abtesting/error_base.rb +2 -6
- data/lib/algolia/models/analytics/error_base.rb +2 -6
- data/lib/algolia/models/ingestion/error_base.rb +2 -6
- data/lib/algolia/models/insights/error_base.rb +2 -6
- data/lib/algolia/models/monitoring/error_base.rb +2 -6
- data/lib/algolia/models/personalization/error_base.rb +2 -6
- data/lib/algolia/models/query-suggestions/error_base.rb +2 -6
- data/lib/algolia/models/recommend/base_search_response.rb +2 -6
- data/lib/algolia/models/recommend/error_base.rb +2 -6
- data/lib/algolia/models/recommend/facet_filters.rb +1 -1
- data/lib/algolia/models/recommend/fallback_params.rb +1 -3
- data/lib/algolia/models/recommend/numeric_filters.rb +1 -1
- data/lib/algolia/models/recommend/optional_filters.rb +1 -1
- data/lib/algolia/models/recommend/re_ranking_apply_filter.rb +1 -1
- data/lib/algolia/models/recommend/recommend_hit.rb +2 -6
- data/lib/algolia/models/recommend/search_params.rb +1 -3
- data/lib/algolia/models/recommend/search_params_object.rb +1 -3
- data/lib/algolia/models/recommend/tag_filters.rb +1 -1
- data/lib/algolia/models/search/base_search_response.rb +2 -6
- data/lib/algolia/models/search/browse_params_object.rb +1 -3
- data/lib/algolia/models/search/consequence_params.rb +1 -3
- data/lib/algolia/models/search/dictionary_entry.rb +2 -6
- data/lib/algolia/models/search/error_base.rb +2 -6
- data/lib/algolia/models/search/facet_filters.rb +1 -1
- data/lib/algolia/models/search/hit.rb +2 -6
- data/lib/algolia/models/search/index_settings.rb +1 -3
- data/lib/algolia/models/search/numeric_filters.rb +1 -1
- data/lib/algolia/models/search/optional_filters.rb +1 -1
- data/lib/algolia/models/search/re_ranking_apply_filter.rb +1 -1
- data/lib/algolia/models/search/search_for_facet_values_response.rb +1 -1
- data/lib/algolia/models/search/search_for_facets.rb +1 -3
- data/lib/algolia/models/search/search_for_hits.rb +1 -3
- data/lib/algolia/models/search/search_hits.rb +2 -6
- data/lib/algolia/models/search/search_params_object.rb +1 -3
- data/lib/algolia/models/search/search_response.rb +2 -6
- data/lib/algolia/models/search/search_synonyms_response.rb +2 -6
- data/lib/algolia/models/search/tag_filters.rb +1 -1
- data/lib/algolia/models/usage/error_base.rb +2 -6
- data/lib/algolia/version.rb +1 -1
- metadata +2 -4
- data/lib/algolia/models/recommend/mixed_search_filters.rb +0 -96
- data/lib/algolia/models/search/mixed_search_filters.rb +0 -96
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ce6d6593d62ae959ce71401e5fc444b5c437ce4012214d537dd78ba0e8345155
|
|
4
|
+
data.tar.gz: c3b0076421efe15774ec8acb41f694a7c99b119d70cc7334eb9f436ca576ac7a
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b6b6d6ba1e60ca6fa73a8734f913b345af4a070b38d0e599b585221b39fa4d79a8f71cf7d739e4517a3e4677aea6521a08eb7defcdb93969e979290d886d11aa
|
|
7
|
+
data.tar.gz: abb19ef9c214cc448e08fe97b53c4205babff68745aa59e15fa30141a22b8230febf5517e215039b6cde468a3d5ebbd881fbb93d2a7457461907dba4936160f9
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [3.0.0.beta.2](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.1...3.0.0.beta.2)
|
|
2
|
+
|
|
3
|
+
- [2b70d9ea5](https://github.com/algolia/api-clients-automation/commit/2b70d9ea5) fix(specs): exhaustiveFacetsCount is not deprecated for sffv ([#3089](https://github.com/algolia/api-clients-automation/pull/3089)) by [@kai687](https://github.com/kai687/)
|
|
4
|
+
- [1250c2b3c](https://github.com/algolia/api-clients-automation/commit/1250c2b3c) fix(specs): simplify filter types ([#3042](https://github.com/algolia/api-clients-automation/pull/3042)) by [@millotp](https://github.com/millotp/)
|
|
5
|
+
|
|
1
6
|
## [3.0.0.beta.1](https://github.com/algolia/algoliasearch-client-ruby/compare/3.0.0.beta.0...3.0.0.beta.1)
|
|
2
7
|
|
|
3
8
|
- [b621988bc](https://github.com/algolia/api-clients-automation/commit/b621988bc) feat(specs): promote @kai687 to code owner ([#3014](https://github.com/algolia/api-clients-automation/pull/3014)) by [@Fluf22](https://github.com/Fluf22/)
|
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
algolia (3.0.0.beta.
|
|
4
|
+
algolia (3.0.0.beta.2)
|
|
5
5
|
faraday (>= 1.0.1, < 3.0)
|
|
6
6
|
faraday-net_http_persistent (>= 0.15, < 3)
|
|
7
7
|
net-http-persistent
|
|
@@ -25,15 +25,15 @@ GEM
|
|
|
25
25
|
net-http-persistent (4.0.2)
|
|
26
26
|
connection_pool (~> 2.2)
|
|
27
27
|
parallel (1.24.0)
|
|
28
|
-
parser (3.3.0
|
|
28
|
+
parser (3.3.1.0)
|
|
29
29
|
ast (~> 2.4.1)
|
|
30
30
|
racc
|
|
31
31
|
racc (1.7.3)
|
|
32
32
|
rainbow (3.1.1)
|
|
33
33
|
rake (13.2.1)
|
|
34
|
-
regexp_parser (2.9.
|
|
34
|
+
regexp_parser (2.9.1)
|
|
35
35
|
rexml (3.2.6)
|
|
36
|
-
rubocop (1.63.
|
|
36
|
+
rubocop (1.63.5)
|
|
37
37
|
json (~> 2.3)
|
|
38
38
|
language_server-protocol (>= 3.17.0)
|
|
39
39
|
parallel (~> 1.10)
|
|
@@ -44,8 +44,8 @@ GEM
|
|
|
44
44
|
rubocop-ast (>= 1.31.1, < 2.0)
|
|
45
45
|
ruby-progressbar (~> 1.7)
|
|
46
46
|
unicode-display_width (>= 2.4.0, < 3.0)
|
|
47
|
-
rubocop-ast (1.31.
|
|
48
|
-
parser (>= 3.3.0
|
|
47
|
+
rubocop-ast (1.31.3)
|
|
48
|
+
parser (>= 3.3.1.0)
|
|
49
49
|
ruby-progressbar (1.13.0)
|
|
50
50
|
unicode-display_width (2.5.0)
|
|
51
51
|
uri (0.13.0)
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -439,12 +439,8 @@ module Algolia
|
|
|
439
439
|
end
|
|
440
440
|
end
|
|
441
441
|
|
|
442
|
-
#
|
|
443
|
-
|
|
444
|
-
@additional_properties.each_pair do |k, v|
|
|
445
|
-
transformed_hash[k.to_sym] = v
|
|
446
|
-
end
|
|
447
|
-
end
|
|
442
|
+
# add extra attribute to transformed_hash
|
|
443
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
448
444
|
new(transformed_hash)
|
|
449
445
|
end
|
|
450
446
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -169,12 +169,8 @@ module Algolia
|
|
|
169
169
|
end
|
|
170
170
|
end
|
|
171
171
|
|
|
172
|
-
#
|
|
173
|
-
|
|
174
|
-
@additional_properties.each_pair do |k, v|
|
|
175
|
-
transformed_hash[k.to_sym] = v
|
|
176
|
-
end
|
|
177
|
-
end
|
|
172
|
+
# add extra attribute to transformed_hash
|
|
173
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
178
174
|
new(transformed_hash)
|
|
179
175
|
end
|
|
180
176
|
|
|
@@ -439,12 +439,8 @@ module Algolia
|
|
|
439
439
|
end
|
|
440
440
|
end
|
|
441
441
|
|
|
442
|
-
#
|
|
443
|
-
|
|
444
|
-
@additional_properties.each_pair do |k, v|
|
|
445
|
-
transformed_hash[k.to_sym] = v
|
|
446
|
-
end
|
|
447
|
-
end
|
|
442
|
+
# add extra attribute to transformed_hash
|
|
443
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
448
444
|
new(transformed_hash)
|
|
449
445
|
end
|
|
450
446
|
|
|
@@ -173,12 +173,8 @@ module Algolia
|
|
|
173
173
|
end
|
|
174
174
|
end
|
|
175
175
|
|
|
176
|
-
#
|
|
177
|
-
|
|
178
|
-
@additional_properties.each_pair do |k, v|
|
|
179
|
-
transformed_hash[k.to_sym] = v
|
|
180
|
-
end
|
|
181
|
-
end
|
|
176
|
+
# add extra attribute to transformed_hash
|
|
177
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
182
178
|
new(transformed_hash)
|
|
183
179
|
end
|
|
184
180
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
|
@@ -139,12 +139,8 @@ module Algolia
|
|
|
139
139
|
end
|
|
140
140
|
end
|
|
141
141
|
|
|
142
|
-
#
|
|
143
|
-
|
|
144
|
-
@additional_properties.each_pair do |k, v|
|
|
145
|
-
transformed_hash[k.to_sym] = v
|
|
146
|
-
end
|
|
147
|
-
end
|
|
142
|
+
# add extra attribute to transformed_hash
|
|
143
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
148
144
|
new(transformed_hash)
|
|
149
145
|
end
|
|
150
146
|
|
|
@@ -9,7 +9,7 @@ module Algolia
|
|
|
9
9
|
# Matching facet values.
|
|
10
10
|
attr_accessor :facet_hits
|
|
11
11
|
|
|
12
|
-
#
|
|
12
|
+
# Whether the facet count is exhaustive (true) or approximate (false). For more information, see [Why are my facet and hit counts not accurate](https://support.algolia.com/hc/en-us/articles/4406975248145-Why-are-my-facet-and-hit-counts-not-accurate-).
|
|
13
13
|
attr_accessor :exhaustive_facets_count
|
|
14
14
|
|
|
15
15
|
# Time the server took to process the request, in milliseconds.
|
|
@@ -122,12 +122,8 @@ module Algolia
|
|
|
122
122
|
end
|
|
123
123
|
end
|
|
124
124
|
|
|
125
|
-
#
|
|
126
|
-
|
|
127
|
-
@additional_properties.each_pair do |k, v|
|
|
128
|
-
transformed_hash[k.to_sym] = v
|
|
129
|
-
end
|
|
130
|
-
end
|
|
125
|
+
# add extra attribute to transformed_hash
|
|
126
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
131
127
|
new(transformed_hash)
|
|
132
128
|
end
|
|
133
129
|
|
|
@@ -483,12 +483,8 @@ module Algolia
|
|
|
483
483
|
end
|
|
484
484
|
end
|
|
485
485
|
|
|
486
|
-
#
|
|
487
|
-
|
|
488
|
-
@additional_properties.each_pair do |k, v|
|
|
489
|
-
transformed_hash[k.to_sym] = v
|
|
490
|
-
end
|
|
491
|
-
end
|
|
486
|
+
# add extra attribute to transformed_hash
|
|
487
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
492
488
|
new(transformed_hash)
|
|
493
489
|
end
|
|
494
490
|
|
|
@@ -110,12 +110,8 @@ module Algolia
|
|
|
110
110
|
end
|
|
111
111
|
end
|
|
112
112
|
|
|
113
|
-
#
|
|
114
|
-
|
|
115
|
-
@additional_properties.each_pair do |k, v|
|
|
116
|
-
transformed_hash[k.to_sym] = v
|
|
117
|
-
end
|
|
118
|
-
end
|
|
113
|
+
# add extra attribute to transformed_hash
|
|
114
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
119
115
|
new(transformed_hash)
|
|
120
116
|
end
|
|
121
117
|
|
|
@@ -94,12 +94,8 @@ module Algolia
|
|
|
94
94
|
end
|
|
95
95
|
end
|
|
96
96
|
|
|
97
|
-
#
|
|
98
|
-
|
|
99
|
-
@additional_properties.each_pair do |k, v|
|
|
100
|
-
transformed_hash[k.to_sym] = v
|
|
101
|
-
end
|
|
102
|
-
end
|
|
97
|
+
# add extra attribute to transformed_hash
|
|
98
|
+
transformed_hash.merge!(attributes.reject { |k, _| attribute_map.key?(k.to_sym) })
|
|
103
99
|
new(transformed_hash)
|
|
104
100
|
end
|
|
105
101
|
|
data/lib/algolia/version.rb
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
2
|
|
|
3
3
|
module Algolia
|
|
4
|
-
VERSION = '3.0.0.beta.
|
|
4
|
+
VERSION = '3.0.0.beta.2'.freeze
|
|
5
5
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: algolia
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 3.0.0.beta.
|
|
4
|
+
version: 3.0.0.beta.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Algolia
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2024-
|
|
11
|
+
date: 2024-05-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -450,7 +450,6 @@ files:
|
|
|
450
450
|
- lib/algolia/models/recommend/looking_similar_query.rb
|
|
451
451
|
- lib/algolia/models/recommend/match_level.rb
|
|
452
452
|
- lib/algolia/models/recommend/matched_geo_location.rb
|
|
453
|
-
- lib/algolia/models/recommend/mixed_search_filters.rb
|
|
454
453
|
- lib/algolia/models/recommend/mode.rb
|
|
455
454
|
- lib/algolia/models/recommend/numeric_filters.rb
|
|
456
455
|
- lib/algolia/models/recommend/optional_filters.rb
|
|
@@ -590,7 +589,6 @@ files:
|
|
|
590
589
|
- lib/algolia/models/search/log_type.rb
|
|
591
590
|
- lib/algolia/models/search/match_level.rb
|
|
592
591
|
- lib/algolia/models/search/matched_geo_location.rb
|
|
593
|
-
- lib/algolia/models/search/mixed_search_filters.rb
|
|
594
592
|
- lib/algolia/models/search/mode.rb
|
|
595
593
|
- lib/algolia/models/search/multiple_batch_request.rb
|
|
596
594
|
- lib/algolia/models/search/multiple_batch_response.rb
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
require 'date'
|
|
4
|
-
require 'time'
|
|
5
|
-
|
|
6
|
-
module Algolia
|
|
7
|
-
module Recommend
|
|
8
|
-
module MixedSearchFilters
|
|
9
|
-
class << self
|
|
10
|
-
# List of class defined in oneOf (OpenAPI v3)
|
|
11
|
-
def openapi_one_of
|
|
12
|
-
[
|
|
13
|
-
:'Array<String>',
|
|
14
|
-
:String
|
|
15
|
-
]
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Builds the object
|
|
19
|
-
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
20
|
-
# @return [Object] Returns the model or the data itself
|
|
21
|
-
def build(data)
|
|
22
|
-
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
23
|
-
# Note:
|
|
24
|
-
# - We do not attempt to check whether exactly one item matches.
|
|
25
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
26
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
27
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
28
|
-
# - TODO: logging when debugging is set.
|
|
29
|
-
openapi_one_of.each do |klass|
|
|
30
|
-
next if klass == :AnyType # "nullable: true"
|
|
31
|
-
|
|
32
|
-
typed_data = find_and_cast_into_type(klass, data)
|
|
33
|
-
return typed_data if typed_data
|
|
34
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
openapi_one_of.include?(:AnyType) ? data : nil
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
private
|
|
41
|
-
|
|
42
|
-
SchemaMismatchError = Class.new(StandardError)
|
|
43
|
-
|
|
44
|
-
# NOTE: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
45
|
-
def find_and_cast_into_type(klass, data)
|
|
46
|
-
return if data.nil?
|
|
47
|
-
|
|
48
|
-
case klass.to_s
|
|
49
|
-
when 'Boolean'
|
|
50
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
51
|
-
when 'Float'
|
|
52
|
-
return data if data.instance_of?(Float)
|
|
53
|
-
when 'Integer'
|
|
54
|
-
return data if data.instance_of?(Integer)
|
|
55
|
-
when 'Time'
|
|
56
|
-
return Time.parse(data)
|
|
57
|
-
when 'Date'
|
|
58
|
-
return Date.parse(data)
|
|
59
|
-
when 'String'
|
|
60
|
-
return data if data.instance_of?(String)
|
|
61
|
-
when 'Object' # "type: object"
|
|
62
|
-
return data if data.instance_of?(Hash)
|
|
63
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
64
|
-
if data.instance_of?(Array)
|
|
65
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
66
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
67
|
-
end
|
|
68
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
69
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
70
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
71
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
72
|
-
end
|
|
73
|
-
else # model
|
|
74
|
-
const = Algolia::Recommend.const_get(klass)
|
|
75
|
-
if const
|
|
76
|
-
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
77
|
-
model = const.build(data)
|
|
78
|
-
else
|
|
79
|
-
# raise if data contains keys that are not known to the model
|
|
80
|
-
raise unless (data.keys - const.acceptable_attributes).empty?
|
|
81
|
-
|
|
82
|
-
model = const.build_from_hash(data)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
return model if model
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
raise # if no match by now, raise
|
|
90
|
-
rescue
|
|
91
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
# Code generated by OpenAPI Generator (https://openapi-generator.tech), manual changes will be lost - read more on https://github.com/algolia/api-clients-automation. DO NOT EDIT.
|
|
2
|
-
|
|
3
|
-
require 'date'
|
|
4
|
-
require 'time'
|
|
5
|
-
|
|
6
|
-
module Algolia
|
|
7
|
-
module Search
|
|
8
|
-
module MixedSearchFilters
|
|
9
|
-
class << self
|
|
10
|
-
# List of class defined in oneOf (OpenAPI v3)
|
|
11
|
-
def openapi_one_of
|
|
12
|
-
[
|
|
13
|
-
:'Array<String>',
|
|
14
|
-
:String
|
|
15
|
-
]
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
# Builds the object
|
|
19
|
-
# @param [Mixed] Data to be matched against the list of oneOf items
|
|
20
|
-
# @return [Object] Returns the model or the data itself
|
|
21
|
-
def build(data)
|
|
22
|
-
# Go through the list of oneOf items and attempt to identify the appropriate one.
|
|
23
|
-
# Note:
|
|
24
|
-
# - We do not attempt to check whether exactly one item matches.
|
|
25
|
-
# - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
|
|
26
|
-
# due to the way the deserialization is made in the base_object template (it just casts without verifying).
|
|
27
|
-
# - TODO: scalar values are de facto behaving as if they were nullable.
|
|
28
|
-
# - TODO: logging when debugging is set.
|
|
29
|
-
openapi_one_of.each do |klass|
|
|
30
|
-
next if klass == :AnyType # "nullable: true"
|
|
31
|
-
|
|
32
|
-
typed_data = find_and_cast_into_type(klass, data)
|
|
33
|
-
return typed_data if typed_data
|
|
34
|
-
rescue # rescue all errors so we keep iterating even if the current item lookup raises
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
openapi_one_of.include?(:AnyType) ? data : nil
|
|
38
|
-
end
|
|
39
|
-
|
|
40
|
-
private
|
|
41
|
-
|
|
42
|
-
SchemaMismatchError = Class.new(StandardError)
|
|
43
|
-
|
|
44
|
-
# NOTE: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
|
|
45
|
-
def find_and_cast_into_type(klass, data)
|
|
46
|
-
return if data.nil?
|
|
47
|
-
|
|
48
|
-
case klass.to_s
|
|
49
|
-
when 'Boolean'
|
|
50
|
-
return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
|
|
51
|
-
when 'Float'
|
|
52
|
-
return data if data.instance_of?(Float)
|
|
53
|
-
when 'Integer'
|
|
54
|
-
return data if data.instance_of?(Integer)
|
|
55
|
-
when 'Time'
|
|
56
|
-
return Time.parse(data)
|
|
57
|
-
when 'Date'
|
|
58
|
-
return Date.parse(data)
|
|
59
|
-
when 'String'
|
|
60
|
-
return data if data.instance_of?(String)
|
|
61
|
-
when 'Object' # "type: object"
|
|
62
|
-
return data if data.instance_of?(Hash)
|
|
63
|
-
when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
|
|
64
|
-
if data.instance_of?(Array)
|
|
65
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
66
|
-
return data.map { |item| find_and_cast_into_type(sub_type, item) }
|
|
67
|
-
end
|
|
68
|
-
when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
|
|
69
|
-
if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
|
|
70
|
-
sub_type = Regexp.last_match[:sub_type]
|
|
71
|
-
return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
|
|
72
|
-
end
|
|
73
|
-
else # model
|
|
74
|
-
const = Algolia::Search.const_get(klass)
|
|
75
|
-
if const
|
|
76
|
-
if const.respond_to?(:openapi_one_of) # nested oneOf model
|
|
77
|
-
model = const.build(data)
|
|
78
|
-
else
|
|
79
|
-
# raise if data contains keys that are not known to the model
|
|
80
|
-
raise unless (data.keys - const.acceptable_attributes).empty?
|
|
81
|
-
|
|
82
|
-
model = const.build_from_hash(data)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
|
-
return model if model
|
|
86
|
-
end
|
|
87
|
-
end
|
|
88
|
-
|
|
89
|
-
raise # if no match by now, raise
|
|
90
|
-
rescue
|
|
91
|
-
raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
|
|
92
|
-
end
|
|
93
|
-
end
|
|
94
|
-
end
|
|
95
|
-
end
|
|
96
|
-
end
|