Skip to content

Commit

Permalink
fix(ruby): use discriminators for oneOf [skip-bc] (generated)
Browse files Browse the repository at this point in the history
algolia/api-clients-automation#4310

Co-authored-by: algolia-bot <[email protected]>
Co-authored-by: Pierre Millot <[email protected]>
  • Loading branch information
algolia-bot and millotp committed Jan 6, 2025
1 parent 5220e7b commit 5bba4f8
Show file tree
Hide file tree
Showing 438 changed files with 538 additions and 2,162 deletions.
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/ab_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/ab_test_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/ab_test_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/ab_tests_variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
# Returns the keys that uniquely identify this oneOf variant when present
def self.discriminator_attributes
[
:customSearchParameters
]
end

# Attribute type mapping.
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/add_ab_tests_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
11 changes: 5 additions & 6 deletions lib/algolia/models/abtesting/add_ab_tests_variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ def build(data)

SchemaMismatchError = Class.new(StandardError)

# Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
def find_and_cast_into_type(klass, data)
return if data.nil?

Expand Down Expand Up @@ -83,12 +82,12 @@ def find_and_cast_into_type(klass, data)
if const.respond_to?(:openapi_one_of)
# nested oneOf model
model = const.build(data)
elsif const.respond_to?(:acceptable_attributes)
# raise if data contains keys that are not known to the model
raise unless (data.keys - const.acceptable_attributes).empty?
model = const.build_from_hash(data)
elsif const.respond_to?(:discriminator_attributes)
if const.discriminator_attributes.all? { |attr| data.key?(attr) }
model = const.build_from_hash(data)
end
else
# maybe it's an enum
# maybe it's an enum, or doens't have discriminators
model = const.build_from_hash(data)
end

Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/currency.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/empty_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/empty_search_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/error_base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/estimate_ab_test_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/estimate_ab_test_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/estimate_configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/filter_effects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/list_ab_tests_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/minimum_detectable_effect.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/outliers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/outliers_filter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/schedule_ab_test_response.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/schedule_ab_tests_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/abtesting/variant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/click_position.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/currency_code.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_add_to_cart_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_average_clicks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_click_through_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_conversion_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_no_click_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_no_results_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
5 changes: 0 additions & 5 deletions lib/algolia/models/analytics/daily_purchase_rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ def self.attribute_map
}
end

# Returns all the JSON keys this model knows about
def self.acceptable_attributes
attribute_map.values
end

# Attribute type mapping.
def self.types_mapping
{
Expand Down
Loading

0 comments on commit 5bba4f8

Please sign in to comment.