Skip to content

Commit ef67057

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Reference Tables API spec: disallow additional properties from FileMetadata (#2771)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent f67cf6d commit ef67057

File tree

3 files changed

+10
-58
lines changed

3 files changed

+10
-58
lines changed

.generator/schemas/v2/openapi.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50997,6 +50997,7 @@ components:
5099750997
- $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataCloudStorage'
5099850998
- $ref: '#/components/schemas/TableResultV2DataAttributesFileMetadataLocalFile'
5099950999
TableResultV2DataAttributesFileMetadataCloudStorage:
51000+
additionalProperties: false
5100051001
description: File metadata for reference tables created by cloud storage.
5100151002
properties:
5100251003
access_details:
@@ -51043,6 +51044,7 @@ components:
5104351044
- OPERATION_ERROR
5104451045
- SYSTEM_ERROR
5104551046
TableResultV2DataAttributesFileMetadataLocalFile:
51047+
additionalProperties: false
5104651048
description: File metadata for reference tables created by upload. Note that
5104751049
upload_id is only returned in the immediate create/replace response and is
5104851050
not available in subsequent GET requests.

lib/datadog_api_client/v2/models/table_result_v2_data_attributes_file_metadata_cloud_storage.rb

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@ class TableResultV2DataAttributesFileMetadataCloudStorage
3636
# Whether this table is synced automatically.
3737
attr_accessor :sync_enabled
3838

39-
attr_accessor :additional_properties
40-
4139
# Attribute mapping from ruby-style variable name to JSON key.
4240
# @!visibility private
4341
def self.attribute_map
@@ -70,14 +68,12 @@ def initialize(attributes = {})
7068
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TableResultV2DataAttributesFileMetadataCloudStorage` initialize method"
7169
end
7270

73-
self.additional_properties = {}
7471
# check to see if the attribute exists and convert string to symbol for hash key
7572
attributes = attributes.each_with_object({}) { |(k, v), h|
7673
if (!self.class.attribute_map.key?(k.to_sym))
77-
self.additional_properties[k.to_sym] = v
78-
else
79-
h[k.to_sym] = v
74+
fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::TableResultV2DataAttributesFileMetadataCloudStorage`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
8075
end
76+
h[k.to_sym] = v
8177
}
8278

8379
if attributes.key?(:'access_details')
@@ -119,26 +115,6 @@ def access_details=(access_details)
119115
@access_details = access_details
120116
end
121117

122-
# Returns the object in the form of hash, with additionalProperties support.
123-
# @return [Hash] Returns the object in the form of hash
124-
# @!visibility private
125-
def to_hash
126-
hash = {}
127-
self.class.attribute_map.each_pair do |attr, param|
128-
value = self.send(attr)
129-
if value.nil?
130-
is_nullable = self.class.openapi_nullable.include?(attr)
131-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
132-
end
133-
134-
hash[param] = _to_hash(value)
135-
end
136-
self.additional_properties.each_pair do |attr, value|
137-
hash[attr] = value
138-
end
139-
hash
140-
end
141-
142118
# Checks equality by comparing each attribute.
143119
# @param o [Object] Object to be compared
144120
# @!visibility private
@@ -149,15 +125,14 @@ def ==(o)
149125
error_message == o.error_message &&
150126
error_row_count == o.error_row_count &&
151127
error_type == o.error_type &&
152-
sync_enabled == o.sync_enabled &&
153-
additional_properties == o.additional_properties
128+
sync_enabled == o.sync_enabled
154129
end
155130

156131
# Calculates hash code according to all attributes.
157132
# @return [Integer] Hash code
158133
# @!visibility private
159134
def hash
160-
[access_details, error_message, error_row_count, error_type, sync_enabled, additional_properties].hash
135+
[access_details, error_message, error_row_count, error_type, sync_enabled].hash
161136
end
162137
end
163138
end

lib/datadog_api_client/v2/models/table_result_v2_data_attributes_file_metadata_local_file.rb

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ class TableResultV2DataAttributesFileMetadataLocalFile
2727
# The number of rows that failed to create/update.
2828
attr_accessor :error_row_count
2929

30-
attr_accessor :additional_properties
31-
3230
# Attribute mapping from ruby-style variable name to JSON key.
3331
# @!visibility private
3432
def self.attribute_map
@@ -55,14 +53,12 @@ def initialize(attributes = {})
5553
fail ArgumentError, "The input argument (attributes) must be a hash in `DatadogAPIClient::V2::TableResultV2DataAttributesFileMetadataLocalFile` initialize method"
5654
end
5755

58-
self.additional_properties = {}
5956
# check to see if the attribute exists and convert string to symbol for hash key
6057
attributes = attributes.each_with_object({}) { |(k, v), h|
6158
if (!self.class.attribute_map.key?(k.to_sym))
62-
self.additional_properties[k.to_sym] = v
63-
else
64-
h[k.to_sym] = v
59+
fail ArgumentError, "`#{k}` is not a valid attribute in `DatadogAPIClient::V2::TableResultV2DataAttributesFileMetadataLocalFile`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
6560
end
61+
h[k.to_sym] = v
6662
}
6763

6864
if attributes.key?(:'error_message')
@@ -74,42 +70,21 @@ def initialize(attributes = {})
7470
end
7571
end
7672

77-
# Returns the object in the form of hash, with additionalProperties support.
78-
# @return [Hash] Returns the object in the form of hash
79-
# @!visibility private
80-
def to_hash
81-
hash = {}
82-
self.class.attribute_map.each_pair do |attr, param|
83-
value = self.send(attr)
84-
if value.nil?
85-
is_nullable = self.class.openapi_nullable.include?(attr)
86-
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
87-
end
88-
89-
hash[param] = _to_hash(value)
90-
end
91-
self.additional_properties.each_pair do |attr, value|
92-
hash[attr] = value
93-
end
94-
hash
95-
end
96-
9773
# Checks equality by comparing each attribute.
9874
# @param o [Object] Object to be compared
9975
# @!visibility private
10076
def ==(o)
10177
return true if self.equal?(o)
10278
self.class == o.class &&
10379
error_message == o.error_message &&
104-
error_row_count == o.error_row_count &&
105-
additional_properties == o.additional_properties
80+
error_row_count == o.error_row_count
10681
end
10782

10883
# Calculates hash code according to all attributes.
10984
# @return [Integer] Hash code
11085
# @!visibility private
11186
def hash
112-
[error_message, error_row_count, additional_properties].hash
87+
[error_message, error_row_count].hash
11388
end
11489
end
11590
end

0 commit comments

Comments
 (0)