Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix monitor search count generation #888

Merged
merged 2 commits into from
May 9, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .generator/src/generator/openapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ def type_to_ruby(schema, alternative_name=None):
elif type_ == "boolean":
return "Boolean"
elif type_ == "array":
return "Array<{}>".format(type_to_ruby(schema["items"]))
return "Array<{}>".format(type_to_ruby(schema["items"], name + "Item" if name else None))
elif type_ == "object":
if "additionalProperties" in schema and not schema.get("properties"):
return "Hash<String, {}>".format(type_to_ruby(schema["additionalProperties"]))
Expand Down Expand Up @@ -113,7 +113,7 @@ def child_models(schema, alternative_name=None, seen=None):
if "items" in schema:
yield from child_models(
schema["items"],
alternative_name=alternative_name + "Item" if alternative_name is not None else None,
alternative_name=name + "Item" if name is not None else None,
seen=seen,
)

Expand Down
7 changes: 1 addition & 6 deletions lib/datadog_api_client/v1.rb
Original file line number Diff line number Diff line change
Expand Up @@ -275,19 +275,14 @@
require 'datadog_api_client/v1/models/monitor_formula_and_function_query_definition'
require 'datadog_api_client/v1/models/monitor_group_search_response'
require 'datadog_api_client/v1/models/monitor_group_search_response_counts'
require 'datadog_api_client/v1/models/monitor_group_search_response_counts_status_item'
require 'datadog_api_client/v1/models/monitor_group_search_response_counts_type_item'
require 'datadog_api_client/v1/models/monitor_group_search_result'
require 'datadog_api_client/v1/models/monitor_options'
require 'datadog_api_client/v1/models/monitor_options_aggregation'
require 'datadog_api_client/v1/models/monitor_overall_states'
require 'datadog_api_client/v1/models/monitor_renotify_status_type'
require 'datadog_api_client/v1/models/monitor_search_count_item'
require 'datadog_api_client/v1/models/monitor_search_response'
require 'datadog_api_client/v1/models/monitor_search_response_counts'
require 'datadog_api_client/v1/models/monitor_search_response_counts_muted_item'
require 'datadog_api_client/v1/models/monitor_search_response_counts_status_item'
require 'datadog_api_client/v1/models/monitor_search_response_counts_tag_item'
require 'datadog_api_client/v1/models/monitor_search_response_counts_type_item'
require 'datadog_api_client/v1/models/monitor_search_response_metadata'
require 'datadog_api_client/v1/models/monitor_search_result'
require 'datadog_api_client/v1/models/monitor_search_result_notification'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ def self.acceptable_attributes
# @!visibility private
def self.openapi_types
{
:'status' => :'Array<Object>',
:'type' => :'Array<Object>'
:'status' => :'Array<MonitorSearchCountItem>',
:'type' => :'Array<MonitorSearchCountItem>'
}
end

Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

module DatadogAPIClient::V1
# A facet item.
class MonitorSearchResponseCountsTagItem
class MonitorSearchCountItem
include BaseGenericModel

# Whether the object has unparsed attributes
Expand Down Expand Up @@ -67,13 +67,13 @@ def self.openapi_nullable
# @!visibility private
def initialize(attributes = {})
if (!attributes.is_a?(Hash))
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::MonitorSearchResponseCountsTagItem` initialize method"
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V1::MonitorSearchCountItem` initialize method"
end

# check to see if the attribute exists and convert string to symbol for hash key
attributes = attributes.each_with_object({}) { |(k, v), h|
if (!self.class.attribute_map.key?(k.to_sym))
fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorSearchResponseCountsTagItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V1::MonitorSearchCountItem`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
end
h[k.to_sym] = v
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ def self.acceptable_attributes
# @!visibility private
def self.openapi_types
{
:'muted' => :'Array<Object>',
:'status' => :'Array<Object>',
:'tag' => :'Array<Object>',
:'type' => :'Array<Object>'
:'muted' => :'Array<MonitorSearchCountItem>',
:'status' => :'Array<MonitorSearchCountItem>',
:'tag' => :'Array<MonitorSearchCountItem>',
:'type' => :'Array<MonitorSearchCountItem>'
}
end

Expand Down
Loading