diff --git a/cdevents-sdk/src/generated/artifact_packaged.rs b/cdevents-sdk/src/generated/artifact_packaged.rs index a8fe025..0466685 100644 --- a/cdevents-sdk/src/generated/artifact_packaged.rs +++ b/cdevents-sdk/src/generated/artifact_packaged.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "change",)] - pub change: Change, + pub change: ContentChange, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Change { +pub struct ContentChange { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/artifact_published.rs b/cdevents-sdk/src/generated/artifact_published.rs index e80c34f..5aed7a4 100644 --- a/cdevents-sdk/src/generated/artifact_published.rs +++ b/cdevents-sdk/src/generated/artifact_published.rs @@ -7,4 +7,3 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { } - diff --git a/cdevents-sdk/src/generated/artifact_signed.rs b/cdevents-sdk/src/generated/artifact_signed.rs index 25a9d3b..2026353 100644 --- a/cdevents-sdk/src/generated/artifact_signed.rs +++ b/cdevents-sdk/src/generated/artifact_signed.rs @@ -9,4 +9,3 @@ pub struct Content { #[serde(rename = "signature",)] pub signature: String, } - diff --git a/cdevents-sdk/src/generated/branch_created.rs b/cdevents-sdk/src/generated/branch_created.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/branch_created.rs +++ b/cdevents-sdk/src/generated/branch_created.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/branch_deleted.rs b/cdevents-sdk/src/generated/branch_deleted.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/branch_deleted.rs +++ b/cdevents-sdk/src/generated/branch_deleted.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/build_finished.rs b/cdevents-sdk/src/generated/build_finished.rs index 1141db9..caad769 100644 --- a/cdevents-sdk/src/generated/build_finished.rs +++ b/cdevents-sdk/src/generated/build_finished.rs @@ -9,4 +9,3 @@ pub struct Content { #[serde(rename = "artifactId", default, skip_serializing_if = "Option::is_none",)] pub artifact_id: Option, } - diff --git a/cdevents-sdk/src/generated/build_queued.rs b/cdevents-sdk/src/generated/build_queued.rs index e80c34f..5aed7a4 100644 --- a/cdevents-sdk/src/generated/build_queued.rs +++ b/cdevents-sdk/src/generated/build_queued.rs @@ -7,4 +7,3 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { } - diff --git a/cdevents-sdk/src/generated/build_started.rs b/cdevents-sdk/src/generated/build_started.rs index e80c34f..5aed7a4 100644 --- a/cdevents-sdk/src/generated/build_started.rs +++ b/cdevents-sdk/src/generated/build_started.rs @@ -7,4 +7,3 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { } - diff --git a/cdevents-sdk/src/generated/change_abandoned.rs b/cdevents-sdk/src/generated/change_abandoned.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/change_abandoned.rs +++ b/cdevents-sdk/src/generated/change_abandoned.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/change_created.rs b/cdevents-sdk/src/generated/change_created.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/change_created.rs +++ b/cdevents-sdk/src/generated/change_created.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/change_merged.rs b/cdevents-sdk/src/generated/change_merged.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/change_merged.rs +++ b/cdevents-sdk/src/generated/change_merged.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/change_reviewed.rs b/cdevents-sdk/src/generated/change_reviewed.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/change_reviewed.rs +++ b/cdevents-sdk/src/generated/change_reviewed.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/change_updated.rs b/cdevents-sdk/src/generated/change_updated.rs index 65e29b9..8576819 100644 --- a/cdevents-sdk/src/generated/change_updated.rs +++ b/cdevents-sdk/src/generated/change_updated.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "repository", default, skip_serializing_if = "Option::is_none",)] - pub repository: Option, + pub repository: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Repository { +pub struct ContentRepository { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/environment_created.rs b/cdevents-sdk/src/generated/environment_created.rs index e2f42cc..1ac2d85 100644 --- a/cdevents-sdk/src/generated/environment_created.rs +++ b/cdevents-sdk/src/generated/environment_created.rs @@ -11,4 +11,3 @@ pub struct Content { #[serde(rename = "url", default, skip_serializing_if = "Option::is_none",)] pub url: Option, } - diff --git a/cdevents-sdk/src/generated/environment_deleted.rs b/cdevents-sdk/src/generated/environment_deleted.rs index d436795..c21a2fa 100644 --- a/cdevents-sdk/src/generated/environment_deleted.rs +++ b/cdevents-sdk/src/generated/environment_deleted.rs @@ -9,4 +9,3 @@ pub struct Content { #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] pub name: Option, } - diff --git a/cdevents-sdk/src/generated/environment_modified.rs b/cdevents-sdk/src/generated/environment_modified.rs index e2f42cc..1ac2d85 100644 --- a/cdevents-sdk/src/generated/environment_modified.rs +++ b/cdevents-sdk/src/generated/environment_modified.rs @@ -11,4 +11,3 @@ pub struct Content { #[serde(rename = "url", default, skip_serializing_if = "Option::is_none",)] pub url: Option, } - diff --git a/cdevents-sdk/src/generated/incident_detected.rs b/cdevents-sdk/src/generated/incident_detected.rs index a2f4d67..5a91da9 100644 --- a/cdevents-sdk/src/generated/incident_detected.rs +++ b/cdevents-sdk/src/generated/incident_detected.rs @@ -11,14 +11,14 @@ pub struct Content { #[serde(rename = "description", default, skip_serializing_if = "Option::is_none",)] pub description: Option, #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "service", default, skip_serializing_if = "Option::is_none",)] - pub service: Option, + pub service: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Service { +pub struct ContentService { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] @@ -27,10 +27,9 @@ pub struct Service { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/incident_reported.rs b/cdevents-sdk/src/generated/incident_reported.rs index fb70170..ec30ed6 100644 --- a/cdevents-sdk/src/generated/incident_reported.rs +++ b/cdevents-sdk/src/generated/incident_reported.rs @@ -11,16 +11,16 @@ pub struct Content { #[serde(rename = "description", default, skip_serializing_if = "Option::is_none",)] pub description: Option, #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "service", default, skip_serializing_if = "Option::is_none",)] - pub service: Option, + pub service: Option, #[serde(rename = "ticketURI",)] pub ticket_uri: crate::Uri, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Service { +pub struct ContentService { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] @@ -29,10 +29,9 @@ pub struct Service { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/incident_resolved.rs b/cdevents-sdk/src/generated/incident_resolved.rs index a2f4d67..5a91da9 100644 --- a/cdevents-sdk/src/generated/incident_resolved.rs +++ b/cdevents-sdk/src/generated/incident_resolved.rs @@ -11,14 +11,14 @@ pub struct Content { #[serde(rename = "description", default, skip_serializing_if = "Option::is_none",)] pub description: Option, #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "service", default, skip_serializing_if = "Option::is_none",)] - pub service: Option, + pub service: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Service { +pub struct ContentService { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] @@ -27,10 +27,9 @@ pub struct Service { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/pipelinerun_finished.rs b/cdevents-sdk/src/generated/pipelinerun_finished.rs index 953e175..bbad121 100644 --- a/cdevents-sdk/src/generated/pipelinerun_finished.rs +++ b/cdevents-sdk/src/generated/pipelinerun_finished.rs @@ -15,4 +15,3 @@ pub struct Content { #[serde(rename = "url", default, skip_serializing_if = "Option::is_none",)] pub url: Option, } - diff --git a/cdevents-sdk/src/generated/pipelinerun_queued.rs b/cdevents-sdk/src/generated/pipelinerun_queued.rs index f949258..45a82fc 100644 --- a/cdevents-sdk/src/generated/pipelinerun_queued.rs +++ b/cdevents-sdk/src/generated/pipelinerun_queued.rs @@ -11,4 +11,3 @@ pub struct Content { #[serde(rename = "url", default, skip_serializing_if = "Option::is_none",)] pub url: Option, } - diff --git a/cdevents-sdk/src/generated/pipelinerun_started.rs b/cdevents-sdk/src/generated/pipelinerun_started.rs index 0939cd8..d69896d 100644 --- a/cdevents-sdk/src/generated/pipelinerun_started.rs +++ b/cdevents-sdk/src/generated/pipelinerun_started.rs @@ -11,4 +11,3 @@ pub struct Content { #[serde(rename = "url",)] pub url: String, } - diff --git a/cdevents-sdk/src/generated/repository_created.rs b/cdevents-sdk/src/generated/repository_created.rs index 85060ef..5523ece 100644 --- a/cdevents-sdk/src/generated/repository_created.rs +++ b/cdevents-sdk/src/generated/repository_created.rs @@ -15,4 +15,3 @@ pub struct Content { #[serde(rename = "viewUrl", default, skip_serializing_if = "Option::is_none",)] pub view_url: Option, } - diff --git a/cdevents-sdk/src/generated/repository_deleted.rs b/cdevents-sdk/src/generated/repository_deleted.rs index 6334f12..e02fea0 100644 --- a/cdevents-sdk/src/generated/repository_deleted.rs +++ b/cdevents-sdk/src/generated/repository_deleted.rs @@ -15,4 +15,3 @@ pub struct Content { #[serde(rename = "viewUrl", default, skip_serializing_if = "Option::is_none",)] pub view_url: Option, } - diff --git a/cdevents-sdk/src/generated/repository_modified.rs b/cdevents-sdk/src/generated/repository_modified.rs index 6334f12..e02fea0 100644 --- a/cdevents-sdk/src/generated/repository_modified.rs +++ b/cdevents-sdk/src/generated/repository_modified.rs @@ -15,4 +15,3 @@ pub struct Content { #[serde(rename = "viewUrl", default, skip_serializing_if = "Option::is_none",)] pub view_url: Option, } - diff --git a/cdevents-sdk/src/generated/service_deployed.rs b/cdevents-sdk/src/generated/service_deployed.rs index 868b9fe..0f6dc2c 100644 --- a/cdevents-sdk/src/generated/service_deployed.rs +++ b/cdevents-sdk/src/generated/service_deployed.rs @@ -9,15 +9,14 @@ pub struct Content { #[serde(rename = "artifactId",)] pub artifact_id: String, #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/service_published.rs b/cdevents-sdk/src/generated/service_published.rs index eaf2687..02e23c7 100644 --- a/cdevents-sdk/src/generated/service_published.rs +++ b/cdevents-sdk/src/generated/service_published.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment", default, skip_serializing_if = "Option::is_none",)] - pub environment: Option, + pub environment: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/service_removed.rs b/cdevents-sdk/src/generated/service_removed.rs index eaf2687..02e23c7 100644 --- a/cdevents-sdk/src/generated/service_removed.rs +++ b/cdevents-sdk/src/generated/service_removed.rs @@ -7,15 +7,14 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment", default, skip_serializing_if = "Option::is_none",)] - pub environment: Option, + pub environment: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/service_rolledback.rs b/cdevents-sdk/src/generated/service_rolledback.rs index 868b9fe..0f6dc2c 100644 --- a/cdevents-sdk/src/generated/service_rolledback.rs +++ b/cdevents-sdk/src/generated/service_rolledback.rs @@ -9,15 +9,14 @@ pub struct Content { #[serde(rename = "artifactId",)] pub artifact_id: String, #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/service_upgraded.rs b/cdevents-sdk/src/generated/service_upgraded.rs index 868b9fe..0f6dc2c 100644 --- a/cdevents-sdk/src/generated/service_upgraded.rs +++ b/cdevents-sdk/src/generated/service_upgraded.rs @@ -9,15 +9,14 @@ pub struct Content { #[serde(rename = "artifactId",)] pub artifact_id: String, #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/taskrun_finished.rs b/cdevents-sdk/src/generated/taskrun_finished.rs index 5259c46..27b4338 100644 --- a/cdevents-sdk/src/generated/taskrun_finished.rs +++ b/cdevents-sdk/src/generated/taskrun_finished.rs @@ -11,7 +11,7 @@ pub struct Content { #[serde(rename = "outcome", default, skip_serializing_if = "Option::is_none",)] pub outcome: Option, #[serde(rename = "pipelineRun", default, skip_serializing_if = "Option::is_none",)] - pub pipeline_run: Option, + pub pipeline_run: Option, #[serde(rename = "taskName", default, skip_serializing_if = "Option::is_none",)] pub task_name: Option, #[serde(rename = "url", default, skip_serializing_if = "Option::is_none",)] @@ -20,10 +20,9 @@ pub struct Content { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct PipelineRun { +pub struct ContentPipelineRun { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/taskrun_started.rs b/cdevents-sdk/src/generated/taskrun_started.rs index d294376..13cba66 100644 --- a/cdevents-sdk/src/generated/taskrun_started.rs +++ b/cdevents-sdk/src/generated/taskrun_started.rs @@ -7,7 +7,7 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "pipelineRun", default, skip_serializing_if = "Option::is_none",)] - pub pipeline_run: Option, + pub pipeline_run: Option, #[serde(rename = "taskName", default, skip_serializing_if = "Option::is_none",)] pub task_name: Option, #[serde(rename = "url", default, skip_serializing_if = "Option::is_none",)] @@ -16,10 +16,9 @@ pub struct Content { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct PipelineRun { +pub struct ContentPipelineRun { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } - diff --git a/cdevents-sdk/src/generated/testcaserun_finished.rs b/cdevents-sdk/src/generated/testcaserun_finished.rs index 018e348..46656e1 100644 --- a/cdevents-sdk/src/generated/testcaserun_finished.rs +++ b/cdevents-sdk/src/generated/testcaserun_finished.rs @@ -7,22 +7,22 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "outcome",)] - pub outcome: String, + pub outcome: ContentOutcome, #[serde(rename = "reason", default, skip_serializing_if = "Option::is_none",)] pub reason: Option, #[serde(rename = "severity", default, skip_serializing_if = "Option::is_none",)] - pub severity: Option, + pub severity: Option, #[serde(rename = "testCase", default, skip_serializing_if = "Option::is_none",)] - pub test_case: Option, + pub test_case: Option, #[serde(rename = "testSuiteRun", default, skip_serializing_if = "Option::is_none",)] - pub test_suite_run: Option, + pub test_suite_run: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestSuiteRun { +pub struct ContentTestSuiteRun { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] @@ -31,13 +31,13 @@ pub struct TestSuiteRun { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestCase { +pub struct ContentTestCase { #[serde(rename = "id",)] pub id: String, #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] pub name: Option, #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, #[serde(rename = "version", default, skip_serializing_if = "Option::is_none",)] @@ -46,10 +46,53 @@ pub struct TestCase { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentOutcome { + #[serde(rename = "pass")] + Pass, + #[serde(rename = "fail")] + Fail, + #[serde(rename = "cancel")] + Cancel, + #[serde(rename = "error")] + Error, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentSeverity { + #[serde(rename = "low")] + Low, + #[serde(rename = "medium")] + Medium, + #[serde(rename = "high")] + High, + #[serde(rename = "critical")] + Critical, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTestCaseType { + #[serde(rename = "performance")] + Performance, + #[serde(rename = "functional")] + Functional, + #[serde(rename = "unit")] + Unit, + #[serde(rename = "security")] + Security, + #[serde(rename = "compliance")] + Compliance, + #[serde(rename = "integration")] + Integration, + #[serde(rename = "e2e")] + E2E, + #[serde(rename = "other")] + Other, +} diff --git a/cdevents-sdk/src/generated/testcaserun_queued.rs b/cdevents-sdk/src/generated/testcaserun_queued.rs index 72c1cf2..1c65fdb 100644 --- a/cdevents-sdk/src/generated/testcaserun_queued.rs +++ b/cdevents-sdk/src/generated/testcaserun_queued.rs @@ -7,27 +7,27 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "testCase", default, skip_serializing_if = "Option::is_none",)] - pub test_case: Option, + pub test_case: Option, #[serde(rename = "testSuiteRun", default, skip_serializing_if = "Option::is_none",)] - pub test_suite_run: Option, + pub test_suite_run: Option, #[serde(rename = "trigger", default, skip_serializing_if = "Option::is_none",)] - pub trigger: Option, + pub trigger: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Trigger { +pub struct ContentTrigger { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestSuiteRun { +pub struct ContentTestSuiteRun { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] @@ -36,13 +36,13 @@ pub struct TestSuiteRun { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestCase { +pub struct ContentTestCase { #[serde(rename = "id",)] pub id: String, #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] pub name: Option, #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, #[serde(rename = "version", default, skip_serializing_if = "Option::is_none",)] @@ -51,10 +51,43 @@ pub struct TestCase { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTestCaseType { + #[serde(rename = "performance")] + Performance, + #[serde(rename = "functional")] + Functional, + #[serde(rename = "unit")] + Unit, + #[serde(rename = "security")] + Security, + #[serde(rename = "compliance")] + Compliance, + #[serde(rename = "integration")] + Integration, + #[serde(rename = "e2e")] + E2E, + #[serde(rename = "other")] + Other, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTriggerType { + #[serde(rename = "manual")] + Manual, + #[serde(rename = "pipeline")] + Pipeline, + #[serde(rename = "event")] + Event, + #[serde(rename = "schedule")] + Schedule, + #[serde(rename = "other")] + Other, +} diff --git a/cdevents-sdk/src/generated/testcaserun_started.rs b/cdevents-sdk/src/generated/testcaserun_started.rs index 72c1cf2..1c65fdb 100644 --- a/cdevents-sdk/src/generated/testcaserun_started.rs +++ b/cdevents-sdk/src/generated/testcaserun_started.rs @@ -7,27 +7,27 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "testCase", default, skip_serializing_if = "Option::is_none",)] - pub test_case: Option, + pub test_case: Option, #[serde(rename = "testSuiteRun", default, skip_serializing_if = "Option::is_none",)] - pub test_suite_run: Option, + pub test_suite_run: Option, #[serde(rename = "trigger", default, skip_serializing_if = "Option::is_none",)] - pub trigger: Option, + pub trigger: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Trigger { +pub struct ContentTrigger { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestSuiteRun { +pub struct ContentTestSuiteRun { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] @@ -36,13 +36,13 @@ pub struct TestSuiteRun { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestCase { +pub struct ContentTestCase { #[serde(rename = "id",)] pub id: String, #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] pub name: Option, #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, #[serde(rename = "version", default, skip_serializing_if = "Option::is_none",)] @@ -51,10 +51,43 @@ pub struct TestCase { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTestCaseType { + #[serde(rename = "performance")] + Performance, + #[serde(rename = "functional")] + Functional, + #[serde(rename = "unit")] + Unit, + #[serde(rename = "security")] + Security, + #[serde(rename = "compliance")] + Compliance, + #[serde(rename = "integration")] + Integration, + #[serde(rename = "e2e")] + E2E, + #[serde(rename = "other")] + Other, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTriggerType { + #[serde(rename = "manual")] + Manual, + #[serde(rename = "pipeline")] + Pipeline, + #[serde(rename = "event")] + Event, + #[serde(rename = "schedule")] + Schedule, + #[serde(rename = "other")] + Other, +} diff --git a/cdevents-sdk/src/generated/testoutput_published.rs b/cdevents-sdk/src/generated/testoutput_published.rs index c16158b..e673427 100644 --- a/cdevents-sdk/src/generated/testoutput_published.rs +++ b/cdevents-sdk/src/generated/testoutput_published.rs @@ -9,19 +9,32 @@ pub struct Content { #[serde(rename = "format",)] pub format: String, #[serde(rename = "outputType",)] - pub output_type: String, + pub output_type: ContentOutputType, #[serde(rename = "testCaseRun", default, skip_serializing_if = "Option::is_none",)] - pub test_case_run: Option, + pub test_case_run: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestCaseRun { +pub struct ContentTestCaseRun { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentOutputType { + #[serde(rename = "report")] + Report, + #[serde(rename = "video")] + Video, + #[serde(rename = "image")] + Image, + #[serde(rename = "log")] + Log, + #[serde(rename = "other")] + Other, +} diff --git a/cdevents-sdk/src/generated/testsuiterun_finished.rs b/cdevents-sdk/src/generated/testsuiterun_finished.rs index 9f384bc..40496ef 100644 --- a/cdevents-sdk/src/generated/testsuiterun_finished.rs +++ b/cdevents-sdk/src/generated/testsuiterun_finished.rs @@ -7,20 +7,20 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "outcome",)] - pub outcome: String, + pub outcome: ContentOutcome, #[serde(rename = "reason", default, skip_serializing_if = "Option::is_none",)] pub reason: Option, #[serde(rename = "severity", default, skip_serializing_if = "Option::is_none",)] - pub severity: Option, + pub severity: Option, #[serde(rename = "testSuite", default, skip_serializing_if = "Option::is_none",)] - pub test_suite: Option, + pub test_suite: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestSuite { +pub struct ContentTestSuite { #[serde(rename = "id",)] pub id: String, #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] @@ -33,10 +33,33 @@ pub struct TestSuite { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentOutcome { + #[serde(rename = "pass")] + Pass, + #[serde(rename = "fail")] + Fail, + #[serde(rename = "cancel")] + Cancel, + #[serde(rename = "error")] + Error, +} + +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentSeverity { + #[serde(rename = "low")] + Low, + #[serde(rename = "medium")] + Medium, + #[serde(rename = "high")] + High, + #[serde(rename = "critical")] + Critical, +} diff --git a/cdevents-sdk/src/generated/testsuiterun_queued.rs b/cdevents-sdk/src/generated/testsuiterun_queued.rs index db1a1f7..1b2e244 100644 --- a/cdevents-sdk/src/generated/testsuiterun_queued.rs +++ b/cdevents-sdk/src/generated/testsuiterun_queued.rs @@ -7,25 +7,25 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "testSuite", default, skip_serializing_if = "Option::is_none",)] - pub test_suite: Option, + pub test_suite: Option, #[serde(rename = "trigger", default, skip_serializing_if = "Option::is_none",)] - pub trigger: Option, + pub trigger: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Trigger { +pub struct ContentTrigger { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestSuite { +pub struct ContentTestSuite { #[serde(rename = "id",)] pub id: String, #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] @@ -38,10 +38,23 @@ pub struct TestSuite { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTriggerType { + #[serde(rename = "manual")] + Manual, + #[serde(rename = "pipeline")] + Pipeline, + #[serde(rename = "event")] + Event, + #[serde(rename = "schedule")] + Schedule, + #[serde(rename = "other")] + Other, +} diff --git a/cdevents-sdk/src/generated/testsuiterun_started.rs b/cdevents-sdk/src/generated/testsuiterun_started.rs index f2c3ff4..3591ca1 100644 --- a/cdevents-sdk/src/generated/testsuiterun_started.rs +++ b/cdevents-sdk/src/generated/testsuiterun_started.rs @@ -7,25 +7,25 @@ use serde::{Serialize, Deserialize}; #[serde(deny_unknown_fields)] pub struct Content { #[serde(rename = "environment",)] - pub environment: Environment, + pub environment: ContentEnvironment, #[serde(rename = "testSuite", default, skip_serializing_if = "Option::is_none",)] - pub test_suite: Option, + pub test_suite: Option, #[serde(rename = "trigger", default, skip_serializing_if = "Option::is_none",)] - pub trigger: Option, + pub trigger: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Trigger { +pub struct ContentTrigger { #[serde(rename = "type", default, skip_serializing_if = "Option::is_none",)] - pub ty: Option, + pub ty: Option, #[serde(rename = "uri", default, skip_serializing_if = "Option::is_none",)] pub uri: Option, } #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct TestSuite { +pub struct ContentTestSuite { #[serde(rename = "id",)] pub id: String, #[serde(rename = "name", default, skip_serializing_if = "Option::is_none",)] @@ -38,10 +38,23 @@ pub struct TestSuite { #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] -pub struct Environment { +pub struct ContentEnvironment { #[serde(rename = "id",)] pub id: String, #[serde(rename = "source", default, skip_serializing_if = "Option::is_none",)] pub source: Option, } +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum ContentTriggerType { + #[serde(rename = "manual")] + Manual, + #[serde(rename = "pipeline")] + Pipeline, + #[serde(rename = "event")] + Event, + #[serde(rename = "schedule")] + Schedule, + #[serde(rename = "other")] + Other, +} diff --git a/generator/src/main.rs b/generator/src/main.rs index 40ffdc1..2cf0425 100644 --- a/generator/src/main.rs +++ b/generator/src/main.rs @@ -107,15 +107,18 @@ fn generate_module(hbs: &Handlebars, variants: &[VariantInfo]) -> Result<(String fn build_data_for_variants(jsonschema: Value) -> Value { let mut structs = vec![]; + let mut enums = vec![]; collect_structs( &mut structs, - "content", + &mut enums, + &["content"], &jsonschema["properties"]["subject"]["properties"]["content"], ); structs.reverse(); json!({ "structs": structs, + "enums": enums, "jsonschema": jsonschema, }) } @@ -139,6 +142,14 @@ struct StructDef { fields: Vec, } +#[derive(Debug, Clone, Serialize, Deserialize)] +struct EnumDef { + type_info: TypeInfo, + json_definition: Value, + /// (is_default, value as string) + values: Vec<(bool, String)>, +} + #[derive(Debug, Clone, Serialize, Deserialize)] struct FieldDef { rust_name: String, @@ -149,7 +160,8 @@ struct FieldDef { fn collect_structs( structs: &mut Vec, - field_name: &str, + enums: &mut Vec, + field_names: &[&str], json_definition: &Value, ) -> TypeInfo { match json_definition["type"].as_str() { @@ -172,9 +184,29 @@ fn collect_structs( // serde_with: Some("crate::serde::uri".to_string()), // }, //TODO manage enum - _ => TypeInfo { - type_declaration: "String".to_string(), - ..Default::default() + _ => match json_definition["enum"].as_array() { + None => TypeInfo { + type_declaration: "String".to_string(), + ..Default::default() + }, + Some(values) => { + let default_value = json_definition["default"].as_str(); + let values = values + .iter() + .map(|v| v.as_str().unwrap_or_default().to_string()) + .map(|v| (default_value == Some(&v), v)) + .collect::>(); + let type_info = TypeInfo { + type_declaration: to_type_name(field_names), + ..Default::default() + }; + enums.push(EnumDef { + type_info: type_info.clone(), + json_definition: json_definition.clone(), + values, + }); + type_info + } }, }, Some("object") => match json_definition["properties"].as_object() { @@ -193,7 +225,11 @@ fn collect_structs( } else { serde_name.to_snake_case() }; - let mut type_info = collect_structs(structs, &serde_name, field.1); + let mut children_field_names = vec![]; + children_field_names.extend_from_slice(field_names); + children_field_names.push(&serde_name); + let mut type_info = + collect_structs(structs, enums, &children_field_names, field.1); let field_name = json!(&serde_name); let is_optional = required.map(|a| !a.contains(&field_name)).unwrap_or(true); @@ -210,7 +246,7 @@ fn collect_structs( }) .collect::>(); let type_info = TypeInfo { - type_declaration: field_name.to_class_case(), + type_declaration: to_type_name(field_names), ..Default::default() }; structs.push(StructDef { @@ -222,6 +258,10 @@ fn collect_structs( } }, Some(x) => todo!("impl for type='{}'", x), - None => unimplemented!("expected key 'type' in field '{}'", field_name), + None => unimplemented!("expected key 'type' in field '{}'", field_names.join(".")), } } + +fn to_type_name(fied_names: &[&str]) -> String { + fied_names.join("_").to_class_case() +} diff --git a/generator/templates/variant.hbs b/generator/templates/variant.hbs index f98780a..1cddc8b 100644 --- a/generator/templates/variant.hbs +++ b/generator/templates/variant.hbs @@ -2,8 +2,8 @@ // by cdevents/sdk-rust/generator (subject.hbs) use serde::{Serialize, Deserialize}; - {{#each structs }} + #[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)] #[serde(deny_unknown_fields)] pub struct {{ this.type_info.type_declaration }} { @@ -15,5 +15,15 @@ pub struct {{ this.type_info.type_declaration }} { pub {{ this.rust_name }}: {{this.type_info.type_declaration }}, {{/each}} } +{{/each}} +{{#each enums }} +#[derive(Debug, Clone, Serialize, Deserialize, Eq, PartialEq)] +pub enum {{ this.type_info.type_declaration }} { + {{#each this.values }} + #[serde(rename = "{{this.1}}")]{{#if this.0}} + #[default]{{/if}} + {{to_class_case this.1}}, + {{/each}} +} {{/each}}