diff --git a/.generator/schemas/v2/openapi.yaml b/.generator/schemas/v2/openapi.yaml index 65d674fb2..99b25f0ac 100644 --- a/.generator/schemas/v2/openapi.yaml +++ b/.generator/schemas/v2/openapi.yaml @@ -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: @@ -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: @@ -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" @@ -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" diff --git a/examples/v2_code-coverage_GetCodeCoverageBranchSummary.rs b/examples/v2_code-coverage_GetCodeCoverageBranchSummary.rs index cc74edd84..57dc4d924 100644 --- a/examples/v2_code-coverage_GetCodeCoverageBranchSummary.rs +++ b/examples/v2_code-coverage_GetCodeCoverageBranchSummary.rs @@ -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(); diff --git a/examples/v2_code-coverage_GetCodeCoverageBranchSummary_2532383345.rs b/examples/v2_code-coverage_GetCodeCoverageBranchSummary_2532383345.rs index aa7c13bd1..308c63d40 100644 --- a/examples/v2_code-coverage_GetCodeCoverageBranchSummary_2532383345.rs +++ b/examples/v2_code-coverage_GetCodeCoverageBranchSummary_2532383345.rs @@ -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(); diff --git a/examples/v2_code-coverage_GetCodeCoverageCommitSummary.rs b/examples/v2_code-coverage_GetCodeCoverageCommitSummary.rs index 87fc2fb1e..2168106a7 100644 --- a/examples/v2_code-coverage_GetCodeCoverageCommitSummary.rs +++ b/examples/v2_code-coverage_GetCodeCoverageCommitSummary.rs @@ -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(); diff --git a/examples/v2_code-coverage_GetCodeCoverageCommitSummary_2575243916.rs b/examples/v2_code-coverage_GetCodeCoverageCommitSummary_2575243916.rs index 4bcc394c9..cce7d7efe 100644 --- a/examples/v2_code-coverage_GetCodeCoverageCommitSummary_2575243916.rs +++ b/examples/v2_code-coverage_GetCodeCoverageCommitSummary_2575243916.rs @@ -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(); diff --git a/src/datadogV2/model/model_branch_coverage_summary_request_attributes.rs b/src/datadogV2/model/model_branch_coverage_summary_request_attributes.rs index 3bee015f8..435615758 100644 --- a/src/datadogV2/model/model_branch_coverage_summary_request_attributes.rs +++ b/src/datadogV2/model/model_branch_coverage_summary_request_attributes.rs @@ -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, + /// The repository URL. Accepts a full URL with or without a scheme (for example, ` or `github.com/org/repo`). + #[serde(rename = "repository_url")] + pub repository_url: Option, #[serde(flatten)] pub additional_properties: std::collections::BTreeMap, #[serde(skip)] @@ -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, @@ -62,6 +80,7 @@ impl<'de> Deserialize<'de> for BranchCoverageSummaryRequestAttributes { { let mut branch: Option = None; let mut repository_id: Option = None; + let mut repository_url: Option = None; let mut additional_properties: std::collections::BTreeMap< String, serde_json::Value, @@ -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); @@ -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, }; diff --git a/src/datadogV2/model/model_commit_coverage_summary_request_attributes.rs b/src/datadogV2/model/model_commit_coverage_summary_request_attributes.rs index d32ee1055..d10e24934 100644 --- a/src/datadogV2/model/model_commit_coverage_summary_request_attributes.rs +++ b/src/datadogV2/model/model_commit_coverage_summary_request_attributes.rs @@ -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, + /// The repository URL. Accepts a full URL with or without a scheme (for example, ` or `github.com/org/repo`). + #[serde(rename = "repository_url")] + pub repository_url: Option, #[serde(flatten)] pub additional_properties: std::collections::BTreeMap, #[serde(skip)] @@ -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, @@ -65,6 +80,7 @@ impl<'de> Deserialize<'de> for CommitCoverageSummaryRequestAttributes { { let mut commit_sha: Option = None; let mut repository_id: Option = None; + let mut repository_url: Option = None; let mut additional_properties: std::collections::BTreeMap< String, serde_json::Value, @@ -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); @@ -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, }; diff --git a/tests/scenarios/features/v2/code_coverage.feature b/tests/scenarios/features/v2/code_coverage.feature index 657ee0375..a103acd21 100644 --- a/tests/scenarios/features/v2/code_coverage.feature +++ b/tests/scenarios/features/v2/code_coverage.feature @@ -13,7 +13,7 @@ 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 @@ -21,7 +21,7 @@ Feature: Code Coverage 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 @@ -29,7 +29,7 @@ Feature: Code Coverage 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 @@ -61,7 +61,7 @@ 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 @@ -69,7 +69,7 @@ Feature: Code Coverage 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 @@ -77,7 +77,7 @@ Feature: Code Coverage 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