Skip to content
Merged
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
22 changes: 16 additions & 6 deletions .generator/schemas/v2/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13100,12 +13100,17 @@ components:
minLength: 1
type: string
repository_id:
description: The repository identifier.
deprecated: true
description: "Deprecated: use `repository_url` instead. The repository URL."
example: github.com/datadog/shopist
minLength: 1
type: string
repository_url:
description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`).
example: https://github.com/datadog/shopist
minLength: 1
type: string
required:
- repository_id
- branch
type: object
BranchCoverageSummaryRequestData:
Expand Down Expand Up @@ -19067,12 +19072,17 @@ components:
pattern: "^[a-fA-F0-9]{40}$"
type: string
repository_id:
description: The repository identifier.
deprecated: true
description: "Deprecated: use `repository_url` instead. The repository URL."
example: github.com/datadog/shopist
minLength: 1
type: string
repository_url:
description: The repository URL. Accepts a full URL with or without a scheme (for example, `https://github.com/org/repo` or `github.com/org/repo`).
example: https://github.com/datadog/shopist
minLength: 1
type: string
required:
- repository_id
- commit_sha
type: object
CommitCoverageSummaryRequestData:
Expand Down Expand Up @@ -122130,7 +122140,7 @@ paths:
data:
attributes:
branch: prod
repository_id: github.com/datadog/test-service
repository_url: https://github.com/datadog/test-service
type: ci_app_coverage_branch_summary_request
schema:
$ref: "#/components/schemas/BranchCoverageSummaryRequest"
Expand Down Expand Up @@ -122200,7 +122210,7 @@ paths:
data:
attributes:
commit_sha: 66adc9350f2cc9b250b69abddab733dd55e1a588
repository_id: github.com/datadog/test-service
repository_url: https://github.com/datadog/test-service
type: ci_app_coverage_commit_summary_request
schema:
$ref: "#/components/schemas/CommitCoverageSummaryRequest"
Expand Down
7 changes: 3 additions & 4 deletions examples/v2_code-coverage_GetCodeCoverageBranchSummary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,9 @@ use datadog_api_client::datadogV2::model::BranchCoverageSummaryRequestType;
#[tokio::main]
async fn main() {
let body = BranchCoverageSummaryRequest::new(BranchCoverageSummaryRequestData::new(
BranchCoverageSummaryRequestAttributes::new(
"prod".to_string(),
"github.com/datadog/shopist".to_string(),
),
BranchCoverageSummaryRequestAttributes::new("prod".to_string())
.repository_id("github.com/datadog/shopist".to_string())
.repository_url("https://github.com/datadog/shopist".to_string()),
BranchCoverageSummaryRequestType::CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST,
));
let mut configuration = datadog::Configuration::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,8 @@ use datadog_api_client::datadogV2::model::BranchCoverageSummaryRequestType;
#[tokio::main]
async fn main() {
let body = BranchCoverageSummaryRequest::new(BranchCoverageSummaryRequestData::new(
BranchCoverageSummaryRequestAttributes::new(
"prod".to_string(),
"github.com/datadog/shopist".to_string(),
),
BranchCoverageSummaryRequestAttributes::new("prod".to_string())
.repository_id("github.com/datadog/shopist".to_string()),
BranchCoverageSummaryRequestType::CI_APP_COVERAGE_BRANCH_SUMMARY_REQUEST,
));
let mut configuration = datadog::Configuration::new();
Expand Down
5 changes: 3 additions & 2 deletions examples/v2_code-coverage_GetCodeCoverageCommitSummary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ async fn main() {
let body = CommitCoverageSummaryRequest::new(CommitCoverageSummaryRequestData::new(
CommitCoverageSummaryRequestAttributes::new(
"66adc9350f2cc9b250b69abddab733dd55e1a588".to_string(),
"github.com/datadog/shopist".to_string(),
),
)
.repository_id("github.com/datadog/shopist".to_string())
.repository_url("https://github.com/datadog/shopist".to_string()),
CommitCoverageSummaryRequestType::CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST,
));
let mut configuration = datadog::Configuration::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ async fn main() {
let body = CommitCoverageSummaryRequest::new(CommitCoverageSummaryRequestData::new(
CommitCoverageSummaryRequestAttributes::new(
"c55b0ce584e139bde41a00002ab31bc7d75f791d".to_string(),
"github.com/datadog/shopist".to_string(),
),
)
.repository_id("github.com/datadog/shopist".to_string()),
CommitCoverageSummaryRequestType::CI_APP_COVERAGE_COMMIT_SUMMARY_REQUEST,
));
let mut configuration = datadog::Configuration::new();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ pub struct BranchCoverageSummaryRequestAttributes {
/// The branch name.
#[serde(rename = "branch")]
pub branch: String,
/// The repository identifier.
/// Deprecated: use `repository_url` instead. The repository URL.
#[deprecated]
#[serde(rename = "repository_id")]
pub repository_id: String,
pub repository_id: Option<String>,
/// The repository URL. Accepts a full URL with or without a scheme (for example, `<https://github.com/org/repo`> or `github.com/org/repo`).
#[serde(rename = "repository_url")]
pub repository_url: Option<String>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
Expand All @@ -25,15 +29,29 @@ pub struct BranchCoverageSummaryRequestAttributes {
}

impl BranchCoverageSummaryRequestAttributes {
pub fn new(branch: String, repository_id: String) -> BranchCoverageSummaryRequestAttributes {
pub fn new(branch: String) -> BranchCoverageSummaryRequestAttributes {
#[allow(deprecated)]
BranchCoverageSummaryRequestAttributes {
branch,
repository_id,
repository_id: None,
repository_url: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

#[allow(deprecated)]
pub fn repository_id(mut self, value: String) -> Self {
self.repository_id = Some(value);
self
}

#[allow(deprecated)]
pub fn repository_url(mut self, value: String) -> Self {
self.repository_url = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -62,6 +80,7 @@ impl<'de> Deserialize<'de> for BranchCoverageSummaryRequestAttributes {
{
let mut branch: Option<String> = None;
let mut repository_id: Option<String> = None;
let mut repository_url: Option<String> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand All @@ -74,9 +93,19 @@ impl<'de> Deserialize<'de> for BranchCoverageSummaryRequestAttributes {
branch = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"repository_id" => {
if v.is_null() {
continue;
}
repository_id =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"repository_url" => {
if v.is_null() {
continue;
}
repository_url =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
Expand All @@ -85,12 +114,12 @@ impl<'de> Deserialize<'de> for BranchCoverageSummaryRequestAttributes {
}
}
let branch = branch.ok_or_else(|| M::Error::missing_field("branch"))?;
let repository_id =
repository_id.ok_or_else(|| M::Error::missing_field("repository_id"))?;

#[allow(deprecated)]
let content = BranchCoverageSummaryRequestAttributes {
branch,
repository_id,
repository_url,
additional_properties,
_unparsed,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ pub struct CommitCoverageSummaryRequestAttributes {
/// The commit SHA (40-character hexadecimal string).
#[serde(rename = "commit_sha")]
pub commit_sha: String,
/// The repository identifier.
/// Deprecated: use `repository_url` instead. The repository URL.
#[deprecated]
#[serde(rename = "repository_id")]
pub repository_id: String,
pub repository_id: Option<String>,
/// The repository URL. Accepts a full URL with or without a scheme (for example, `<https://github.com/org/repo`> or `github.com/org/repo`).
#[serde(rename = "repository_url")]
pub repository_url: Option<String>,
#[serde(flatten)]
pub additional_properties: std::collections::BTreeMap<String, serde_json::Value>,
#[serde(skip)]
Expand All @@ -25,18 +29,29 @@ pub struct CommitCoverageSummaryRequestAttributes {
}

impl CommitCoverageSummaryRequestAttributes {
pub fn new(
commit_sha: String,
repository_id: String,
) -> CommitCoverageSummaryRequestAttributes {
pub fn new(commit_sha: String) -> CommitCoverageSummaryRequestAttributes {
#[allow(deprecated)]
CommitCoverageSummaryRequestAttributes {
commit_sha,
repository_id,
repository_id: None,
repository_url: None,
additional_properties: std::collections::BTreeMap::new(),
_unparsed: false,
}
}

#[allow(deprecated)]
pub fn repository_id(mut self, value: String) -> Self {
self.repository_id = Some(value);
self
}

#[allow(deprecated)]
pub fn repository_url(mut self, value: String) -> Self {
self.repository_url = Some(value);
self
}

pub fn additional_properties(
mut self,
value: std::collections::BTreeMap<String, serde_json::Value>,
Expand Down Expand Up @@ -65,6 +80,7 @@ impl<'de> Deserialize<'de> for CommitCoverageSummaryRequestAttributes {
{
let mut commit_sha: Option<String> = None;
let mut repository_id: Option<String> = None;
let mut repository_url: Option<String> = None;
let mut additional_properties: std::collections::BTreeMap<
String,
serde_json::Value,
Expand All @@ -77,9 +93,19 @@ impl<'de> Deserialize<'de> for CommitCoverageSummaryRequestAttributes {
commit_sha = Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"repository_id" => {
if v.is_null() {
continue;
}
repository_id =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
"repository_url" => {
if v.is_null() {
continue;
}
repository_url =
Some(serde_json::from_value(v).map_err(M::Error::custom)?);
}
&_ => {
if let Ok(value) = serde_json::from_value(v.clone()) {
additional_properties.insert(k, value);
Expand All @@ -88,12 +114,12 @@ impl<'de> Deserialize<'de> for CommitCoverageSummaryRequestAttributes {
}
}
let commit_sha = commit_sha.ok_or_else(|| M::Error::missing_field("commit_sha"))?;
let repository_id =
repository_id.ok_or_else(|| M::Error::missing_field("repository_id"))?;

#[allow(deprecated)]
let content = CommitCoverageSummaryRequestAttributes {
commit_sha,
repository_id,
repository_url,
additional_properties,
_unparsed,
};
Expand Down
12 changes: 6 additions & 6 deletions tests/scenarios/features/v2/code_coverage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ Feature: Code Coverage
Scenario: Get code coverage summary for a branch returns "Bad Request" response
Given operation "GetCodeCoverageBranchSummary" enabled
And new "GetCodeCoverageBranchSummary" request
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a branch returns "Not Found" response
Given operation "GetCodeCoverageBranchSummary" enabled
And new "GetCodeCoverageBranchSummary" request
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a branch returns "OK" response
Given operation "GetCodeCoverageBranchSummary" enabled
And new "GetCodeCoverageBranchSummary" request
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
And body with value {"data": {"attributes": {"branch": "prod", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_branch_summary_request"}}
When the request is sent
Then the response status is 200 OK

Expand Down Expand Up @@ -61,23 +61,23 @@ Feature: Code Coverage
Scenario: Get code coverage summary for a commit returns "Bad Request" response
Given operation "GetCodeCoverageCommitSummary" enabled
And new "GetCodeCoverageCommitSummary" request
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
When the request is sent
Then the response status is 400 Bad Request

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a commit returns "Not Found" response
Given operation "GetCodeCoverageCommitSummary" enabled
And new "GetCodeCoverageCommitSummary" request
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
When the request is sent
Then the response status is 404 Not Found

@generated @skip @team:DataDog/ci-app-backend
Scenario: Get code coverage summary for a commit returns "OK" response
Given operation "GetCodeCoverageCommitSummary" enabled
And new "GetCodeCoverageCommitSummary" request
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
And body with value {"data": {"attributes": {"commit_sha": "66adc9350f2cc9b250b69abddab733dd55e1a588", "repository_id": "github.com/datadog/shopist", "repository_url": "https://github.com/datadog/shopist"}, "type": "ci_app_coverage_commit_summary_request"}}
When the request is sent
Then the response status is 200 OK

Expand Down
Loading