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

Add missing color property to create team attributes #1360

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
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
8 changes: 4 additions & 4 deletions .apigentools-info
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"spec_versions": {
"v1": {
"apigentools_version": "1.6.4",
"regenerated": "2023-05-04 20:09:05.103133",
"spec_repo_commit": "ff8b9894"
"regenerated": "2023-05-05 18:11:52.704081",
"spec_repo_commit": "534fc2d7"
},
"v2": {
"apigentools_version": "1.6.4",
"regenerated": "2023-05-04 20:09:05.120269",
"spec_repo_commit": "ff8b9894"
"regenerated": "2023-05-05 18:11:52.717713",
"spec_repo_commit": "534fc2d7"
}
}
}
6 changes: 6 additions & 0 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13500,6 +13500,12 @@ components:
TeamCreateAttributes:
description: Team creation attributes
properties:
color:
description: An identifier for the color representing the team
format: int32
maximum: 13
minimum: 0
type: integer
description:
description: Free-form markdown description/content for the team's homepage
type: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2023-03-27T18:33:02.181Z
2023-05-05T17:56:05.119Z

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions examples/v2/teams/CreateTeam.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
attributes: DatadogAPIClient::V2::TeamCreateAttributes.new({
handle: "1636629071",
name: "1636629071",
color: 6,
}),
relationships: DatadogAPIClient::V2::TeamCreateRelationships.new({
users: DatadogAPIClient::V2::RelationshipToUsers.new({
Expand Down
5 changes: 4 additions & 1 deletion features/v2/teams.feature
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,12 @@ Feature: Teams
@team:DataDog/core-app
Scenario: Create a team returns "CREATED" response
Given new "CreateTeam" request
And body with value {"data": {"attributes": {"handle": "{{timestamp('now')}}", "name": "{{timestamp('now')}}"}, "relationships": {"users": {"data": []}}, "type": "team"}}
And body with value {"data": {"attributes": {"handle": "{{timestamp('now')}}", "name": "{{timestamp('now')}}", "color": 6}, "relationships": {"users": {"data": []}}, "type": "team"}}
When the request is sent
Then the response status is 201 CREATED
And the response "data.attributes.handle" is equal to "{{timestamp('now')}}"
And the response "data.attributes.name" is equal to "{{timestamp('now')}}"
And the response "data.attributes.color" is equal to 6

@team:DataDog/core-app
Scenario: Get a team link returns "API error response." response
Expand Down
27 changes: 26 additions & 1 deletion lib/datadog_api_client/v2/models/team_create_attributes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ class TeamCreateAttributes
# @!visibility private
attr_accessor :_unparsed

# An identifier for the color representing the team
attr_reader :color

# Free-form markdown description/content for the team's homepage
attr_accessor :description

Expand All @@ -41,6 +44,7 @@ class TeamCreateAttributes
# @!visibility private
def self.attribute_map
{
:'color' => :'color',
:'description' => :'description',
:'handle' => :'handle',
:'link_count' => :'link_count',
Expand All @@ -52,6 +56,7 @@ def self.attribute_map
# @!visibility private
def self.openapi_types
{
:'color' => :'Integer',
:'description' => :'String',
:'handle' => :'String',
:'link_count' => :'Integer',
Expand All @@ -75,6 +80,10 @@ def initialize(attributes = {})
h[k.to_sym] = v
}

if attributes.key?(:'color')
self.color = attributes[:'color']
end

if attributes.key?(:'description')
self.description = attributes[:'description']
end
Expand All @@ -96,6 +105,8 @@ def initialize(attributes = {})
# @return true if the model is valid
# @!visibility private
def valid?
return false if !@color.nil? && @color > 13
return false if !@color.nil? && @color < 0
return false if @handle.nil?
return false if @handle.to_s.length > 64
return false if !@link_count.nil? && @link_count > 2147483647
Expand All @@ -104,6 +115,19 @@ def valid?
true
end

# Custom attribute writer method with validation
# @param color [Object] Object to be assigned
# @!visibility private
def color=(color)
if !color.nil? && color > 13
fail ArgumentError, 'invalid value for "color", must be smaller than or equal to 13.'
end
if !color.nil? && color < 0
fail ArgumentError, 'invalid value for "color", must be greater than or equal to 0.'
end
@color = color
end

# Custom attribute writer method with validation
# @param handle [Object] Object to be assigned
# @!visibility private
Expand Down Expand Up @@ -146,6 +170,7 @@ def name=(name)
def ==(o)
return true if self.equal?(o)
self.class == o.class &&
color == o.color &&
description == o.description &&
handle == o.handle &&
link_count == o.link_count &&
Expand All @@ -156,7 +181,7 @@ def ==(o)
# @return [Integer] Hash code
# @!visibility private
def hash
[description, handle, link_count, name].hash
[color, description, handle, link_count, name].hash
end
end
end