-
Notifications
You must be signed in to change notification settings - Fork 21
SDCD-1142: adding custom_tags optional attribute to DORA API spec
#2451
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,9 @@ module DatadogAPIClient::V2 | |
| class DORAFailureRequestAttributes | ||
| include BaseGenericModel | ||
|
|
||
| # A list of user-defined tags. The tags must follow the `key:value` pattern. Up to 100 may be added per event. | ||
| attr_accessor :custom_tags | ||
|
|
||
| # Environment name that was impacted by the failure. | ||
| attr_accessor :env | ||
|
|
||
|
|
@@ -57,6 +60,7 @@ class DORAFailureRequestAttributes | |
| # @!visibility private | ||
| def self.attribute_map | ||
| { | ||
| :'custom_tags' => :'custom_tags', | ||
| :'env' => :'env', | ||
| :'finished_at' => :'finished_at', | ||
| :'git' => :'git', | ||
|
|
@@ -74,6 +78,7 @@ def self.attribute_map | |
| # @!visibility private | ||
| def self.openapi_types | ||
| { | ||
| :'custom_tags' => :'Array<String>', | ||
| :'env' => :'String', | ||
| :'finished_at' => :'Integer', | ||
| :'git' => :'DORAGitInfo', | ||
|
|
@@ -87,6 +92,14 @@ def self.openapi_types | |
| } | ||
| end | ||
|
|
||
| # List of attributes with nullable: true | ||
| # @!visibility private | ||
| def self.openapi_nullable | ||
| Set.new([ | ||
| :'custom_tags', | ||
| ]) | ||
| end | ||
|
|
||
| # Initializes the object | ||
| # @param attributes [Hash] Model attributes in the form of hash | ||
| # @!visibility private | ||
|
|
@@ -105,6 +118,12 @@ def initialize(attributes = {}) | |
| end | ||
| } | ||
|
|
||
| if attributes.key?(:'custom_tags') | ||
| if (value = attributes[:'custom_tags']).is_a?(Array) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ⚪ Code Quality ViolationConsider using Array() to ensure the type is that of an array (...read more)The rule "Use The By using |
||
| self.custom_tags = value | ||
| end | ||
| end | ||
|
|
||
| if attributes.key?(:'env') | ||
| self.env = attributes[:'env'] | ||
| end | ||
|
|
@@ -192,6 +211,7 @@ def to_hash | |
| def ==(o) | ||
| return true if self.equal?(o) | ||
| self.class == o.class && | ||
| custom_tags == o.custom_tags && | ||
| env == o.env && | ||
| finished_at == o.finished_at && | ||
| git == o.git && | ||
|
|
@@ -209,7 +229,7 @@ def ==(o) | |
| # @return [Integer] Hash code | ||
| # @!visibility private | ||
| def hash | ||
| [env, finished_at, git, id, name, services, severity, started_at, team, version, additional_properties].hash | ||
| [custom_tags, env, finished_at, git, id, name, services, severity, started_at, team, version, additional_properties].hash | ||
| end | ||
| end | ||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
⚪ Code Quality Violation
Consider using Array() to ensure the type is that of an array (...read more)
The rule "Use
Array()to ensure your variable is an array" is important for ensuring your code behaves as expected, regardless of the type of data it receives. It is common in Ruby to need to iterate through an array of items. However, if the variable is not an array, this can lead to unexpected behavior or errors.The
Array()method in Ruby is a Kernel method that converts its argument to an Array. If the argument is already an Array, it returns the argument. If the argument is nil, it returns an empty Array. This can be used to ensure that a variable is an array before trying to iterate over it, preventing potential errors or unexpected behavior.By using
Array(foos), you can ensure thatfoosis an array before you try to iterate over it witheach. This prevents the need to check iffoosis an array withfoos.is_a?(Array)and makes your code cleaner and easier to understand.