From 70602b2cf9c6d36f3d2da7818512ea97414a2cb0 Mon Sep 17 00:00:00 2001 From: Andrea Frittoli Date: Wed, 1 May 2024 22:04:25 +0100 Subject: [PATCH] Add the event version name Add the event version name in the generated filename as well as in the type names, so that we may host different versions within the SDK. Signed-off-by: Andrea Frittoli --- ...ckaged.go => zz_artifactpackaged_0_1_1.go} | 6 +- ...ished.go => zz_artifactpublished_0_1_1.go} | 6 +- ...ctsigned.go => zz_artifactsigned_0_1_0.go} | 6 +- ...chcreated.go => zz_branchcreated_0_1_2.go} | 6 +- ...chdeleted.go => zz_branchdeleted_0_1_2.go} | 6 +- ...dfinished.go => zz_buildfinished_0_1_1.go} | 6 +- ...buildqueued.go => zz_buildqueued_0_1_1.go} | 6 +- ...ildstarted.go => zz_buildstarted_0_1_1.go} | 6 +- ...andoned.go => zz_changeabandoned_0_1_2.go} | 6 +- ...gecreated.go => zz_changecreated_0_1_2.go} | 6 +- ...angemerged.go => zz_changemerged_0_1_2.go} | 6 +- ...reviewed.go => zz_changereviewed_0_1_2.go} | 6 +- ...geupdated.go => zz_changeupdated_0_1_2.go} | 6 +- ...ated.go => zz_environmentcreated_0_1_1.go} | 6 +- ...eted.go => zz_environmentdeleted_0_1_1.go} | 6 +- ...ied.go => zz_environmentmodified_0_1_1.go} | 6 +- pkg/api/zz_factory_test.go | 156 +++++++++--------- ...tected.go => zz_incidentdetected_0_1_0.go} | 6 +- ...ported.go => zz_incidentreported_0_1_0.go} | 6 +- ...solved.go => zz_incidentresolved_0_1_0.go} | 6 +- ...hed.go => zz_pipelinerunfinished_0_1_1.go} | 6 +- ...ueued.go => zz_pipelinerunqueued_0_1_1.go} | 6 +- ...rted.go => zz_pipelinerunstarted_0_1_1.go} | 6 +- ...eated.go => zz_repositorycreated_0_1_1.go} | 6 +- ...leted.go => zz_repositorydeleted_0_1_1.go} | 6 +- ...fied.go => zz_repositorymodified_0_1_1.go} | 6 +- ...eployed.go => zz_servicedeployed_0_1_1.go} | 6 +- ...lished.go => zz_servicepublished_0_1_1.go} | 6 +- ...eremoved.go => zz_serviceremoved_0_1_1.go} | 6 +- ...dback.go => zz_servicerolledback_0_1_1.go} | 6 +- ...pgraded.go => zz_serviceupgraded_0_1_1.go} | 6 +- ...inished.go => zz_taskrunfinished_0_1_1.go} | 6 +- ...nstarted.go => zz_taskrunstarted_0_1_1.go} | 6 +- ...hed.go => zz_testcaserunfinished_0_1_0.go} | 6 +- ...ueued.go => zz_testcaserunqueued_0_1_0.go} | 6 +- ...rted.go => zz_testcaserunstarted_0_1_0.go} | 6 +- ...hed.go => zz_testoutputpublished_0_1_0.go} | 6 +- ...ed.go => zz_testsuiterunfinished_0_1_0.go} | 6 +- ...eued.go => zz_testsuiterunqueued_0_1_0.go} | 6 +- ...ted.go => zz_testsuiterunstarted_0_1_0.go} | 6 +- pkg/api/zz_types.go | 78 ++++----- ... zz_ztest_foosubjectbarpredicate_1_2_3.go} | 8 +- tools/generator.go | 11 +- tools/generator_test.go | 2 + tools/templates/event.go.tmpl | 6 +- tools/templates/factory_test.go.tmpl | 4 +- tools/templates/types.go.tmpl | 2 +- tools/templates_test/event.go.tmpl | 8 +- 48 files changed, 257 insertions(+), 252 deletions(-) rename pkg/api/{zz_artifactpackaged.go => zz_artifactpackaged_0_1_1.go} (97%) rename pkg/api/{zz_artifactpublished.go => zz_artifactpublished_0_1_1.go} (97%) rename pkg/api/{zz_artifactsigned.go => zz_artifactsigned_0_1_0.go} (97%) rename pkg/api/{zz_branchcreated.go => zz_branchcreated_0_1_2.go} (97%) rename pkg/api/{zz_branchdeleted.go => zz_branchdeleted_0_1_2.go} (97%) rename pkg/api/{zz_buildfinished.go => zz_buildfinished_0_1_1.go} (97%) rename pkg/api/{zz_buildqueued.go => zz_buildqueued_0_1_1.go} (97%) rename pkg/api/{zz_buildstarted.go => zz_buildstarted_0_1_1.go} (97%) rename pkg/api/{zz_changeabandoned.go => zz_changeabandoned_0_1_2.go} (97%) rename pkg/api/{zz_changecreated.go => zz_changecreated_0_1_2.go} (97%) rename pkg/api/{zz_changemerged.go => zz_changemerged_0_1_2.go} (97%) rename pkg/api/{zz_changereviewed.go => zz_changereviewed_0_1_2.go} (97%) rename pkg/api/{zz_changeupdated.go => zz_changeupdated_0_1_2.go} (97%) rename pkg/api/{zz_environmentcreated.go => zz_environmentcreated_0_1_1.go} (97%) rename pkg/api/{zz_environmentdeleted.go => zz_environmentdeleted_0_1_1.go} (97%) rename pkg/api/{zz_environmentmodified.go => zz_environmentmodified_0_1_1.go} (97%) rename pkg/api/{zz_incidentdetected.go => zz_incidentdetected_0_1_0.go} (97%) rename pkg/api/{zz_incidentreported.go => zz_incidentreported_0_1_0.go} (97%) rename pkg/api/{zz_incidentresolved.go => zz_incidentresolved_0_1_0.go} (97%) rename pkg/api/{zz_pipelinerunfinished.go => zz_pipelinerunfinished_0_1_1.go} (97%) rename pkg/api/{zz_pipelinerunqueued.go => zz_pipelinerunqueued_0_1_1.go} (97%) rename pkg/api/{zz_pipelinerunstarted.go => zz_pipelinerunstarted_0_1_1.go} (97%) rename pkg/api/{zz_repositorycreated.go => zz_repositorycreated_0_1_1.go} (97%) rename pkg/api/{zz_repositorydeleted.go => zz_repositorydeleted_0_1_1.go} (97%) rename pkg/api/{zz_repositorymodified.go => zz_repositorymodified_0_1_1.go} (97%) rename pkg/api/{zz_servicedeployed.go => zz_servicedeployed_0_1_1.go} (97%) rename pkg/api/{zz_servicepublished.go => zz_servicepublished_0_1_1.go} (97%) rename pkg/api/{zz_serviceremoved.go => zz_serviceremoved_0_1_1.go} (97%) rename pkg/api/{zz_servicerolledback.go => zz_servicerolledback_0_1_1.go} (97%) rename pkg/api/{zz_serviceupgraded.go => zz_serviceupgraded_0_1_1.go} (97%) rename pkg/api/{zz_taskrunfinished.go => zz_taskrunfinished_0_1_1.go} (97%) rename pkg/api/{zz_taskrunstarted.go => zz_taskrunstarted_0_1_1.go} (97%) rename pkg/api/{zz_testcaserunfinished.go => zz_testcaserunfinished_0_1_0.go} (97%) rename pkg/api/{zz_testcaserunqueued.go => zz_testcaserunqueued_0_1_0.go} (98%) rename pkg/api/{zz_testcaserunstarted.go => zz_testcaserunstarted_0_1_0.go} (98%) rename pkg/api/{zz_testoutputpublished.go => zz_testoutputpublished_0_1_0.go} (97%) rename pkg/api/{zz_testsuiterunfinished.go => zz_testsuiterunfinished_0_1_0.go} (97%) rename pkg/api/{zz_testsuiterunqueued.go => zz_testsuiterunqueued_0_1_0.go} (97%) rename pkg/api/{zz_testsuiterunstarted.go => zz_testsuiterunstarted_0_1_0.go} (97%) rename pkg/api/{zz_ztest_foosubjectbarpredicate.go => zz_ztest_foosubjectbarpredicate_1_2_3.go} (97%) diff --git a/pkg/api/zz_artifactpackaged.go b/pkg/api/zz_artifactpackaged_0_1_1.go similarity index 97% rename from pkg/api/zz_artifactpackaged.go rename to pkg/api/zz_artifactpackaged_0_1_1.go index c693eb3..0c5aa6e 100644 --- a/pkg/api/zz_artifactpackaged.go +++ b/pkg/api/zz_artifactpackaged_0_1_1.go @@ -29,7 +29,7 @@ var artifactpackagedschema = `{"$schema":"https://json-schema.org/draft/2020-12/ var ( // ArtifactPackaged event v0.1.1 - ArtifactPackagedEventV1 CDEventType = CDEventType{ + ArtifactPackagedEventV0_1_1 CDEventType = CDEventType{ Subject: "artifact", Predicate: "packaged", Version: "0.1.1", @@ -58,7 +58,7 @@ type ArtifactPackagedEvent struct { // CDEventsReader implementation func (e ArtifactPackagedEvent) GetType() CDEventType { - return ArtifactPackagedEventV1 + return ArtifactPackagedEventV0_1_1 } func (e ArtifactPackagedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ArtifactPackagedEvent) SetSubjectChange(change *Reference) { func NewArtifactPackagedEvent() (*ArtifactPackagedEvent, error) { e := &ArtifactPackagedEvent{ Context: Context{ - Type: ArtifactPackagedEventV1.String(), + Type: ArtifactPackagedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ArtifactPackagedSubject{ diff --git a/pkg/api/zz_artifactpublished.go b/pkg/api/zz_artifactpublished_0_1_1.go similarity index 97% rename from pkg/api/zz_artifactpublished.go rename to pkg/api/zz_artifactpublished_0_1_1.go index e5c0e5c..12797d7 100644 --- a/pkg/api/zz_artifactpublished.go +++ b/pkg/api/zz_artifactpublished_0_1_1.go @@ -29,7 +29,7 @@ var artifactpublishedschema = `{"$schema":"https://json-schema.org/draft/2020-12 var ( // ArtifactPublished event v0.1.1 - ArtifactPublishedEventV1 CDEventType = CDEventType{ + ArtifactPublishedEventV0_1_1 CDEventType = CDEventType{ Subject: "artifact", Predicate: "published", Version: "0.1.1", @@ -57,7 +57,7 @@ type ArtifactPublishedEvent struct { // CDEventsReader implementation func (e ArtifactPublishedEvent) GetType() CDEventType { - return ArtifactPublishedEventV1 + return ArtifactPublishedEventV0_1_1 } func (e ArtifactPublishedEvent) GetVersion() string { @@ -151,7 +151,7 @@ func (e ArtifactPublishedEvent) GetSchema() (string, string) { func NewArtifactPublishedEvent() (*ArtifactPublishedEvent, error) { e := &ArtifactPublishedEvent{ Context: Context{ - Type: ArtifactPublishedEventV1.String(), + Type: ArtifactPublishedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ArtifactPublishedSubject{ diff --git a/pkg/api/zz_artifactsigned.go b/pkg/api/zz_artifactsigned_0_1_0.go similarity index 97% rename from pkg/api/zz_artifactsigned.go rename to pkg/api/zz_artifactsigned_0_1_0.go index c49a09e..b2dd983 100644 --- a/pkg/api/zz_artifactsigned.go +++ b/pkg/api/zz_artifactsigned_0_1_0.go @@ -29,7 +29,7 @@ var artifactsignedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sc var ( // ArtifactSigned event v0.1.0 - ArtifactSignedEventV1 CDEventType = CDEventType{ + ArtifactSignedEventV0_1_0 CDEventType = CDEventType{ Subject: "artifact", Predicate: "signed", Version: "0.1.0", @@ -58,7 +58,7 @@ type ArtifactSignedEvent struct { // CDEventsReader implementation func (e ArtifactSignedEvent) GetType() CDEventType { - return ArtifactSignedEventV1 + return ArtifactSignedEventV0_1_0 } func (e ArtifactSignedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ArtifactSignedEvent) SetSubjectSignature(signature string) { func NewArtifactSignedEvent() (*ArtifactSignedEvent, error) { e := &ArtifactSignedEvent{ Context: Context{ - Type: ArtifactSignedEventV1.String(), + Type: ArtifactSignedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: ArtifactSignedSubject{ diff --git a/pkg/api/zz_branchcreated.go b/pkg/api/zz_branchcreated_0_1_2.go similarity index 97% rename from pkg/api/zz_branchcreated.go rename to pkg/api/zz_branchcreated_0_1_2.go index 2fd442e..678b5b8 100644 --- a/pkg/api/zz_branchcreated.go +++ b/pkg/api/zz_branchcreated_0_1_2.go @@ -29,7 +29,7 @@ var branchcreatedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sch var ( // BranchCreated event v0.1.2 - BranchCreatedEventV1 CDEventType = CDEventType{ + BranchCreatedEventV0_1_2 CDEventType = CDEventType{ Subject: "branch", Predicate: "created", Version: "0.1.2", @@ -58,7 +58,7 @@ type BranchCreatedEvent struct { // CDEventsReader implementation func (e BranchCreatedEvent) GetType() CDEventType { - return BranchCreatedEventV1 + return BranchCreatedEventV0_1_2 } func (e BranchCreatedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *BranchCreatedEvent) SetSubjectRepository(repository *Reference) { func NewBranchCreatedEvent() (*BranchCreatedEvent, error) { e := &BranchCreatedEvent{ Context: Context{ - Type: BranchCreatedEventV1.String(), + Type: BranchCreatedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: BranchCreatedSubject{ diff --git a/pkg/api/zz_branchdeleted.go b/pkg/api/zz_branchdeleted_0_1_2.go similarity index 97% rename from pkg/api/zz_branchdeleted.go rename to pkg/api/zz_branchdeleted_0_1_2.go index b12ef4b..e809e57 100644 --- a/pkg/api/zz_branchdeleted.go +++ b/pkg/api/zz_branchdeleted_0_1_2.go @@ -29,7 +29,7 @@ var branchdeletedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sch var ( // BranchDeleted event v0.1.2 - BranchDeletedEventV1 CDEventType = CDEventType{ + BranchDeletedEventV0_1_2 CDEventType = CDEventType{ Subject: "branch", Predicate: "deleted", Version: "0.1.2", @@ -58,7 +58,7 @@ type BranchDeletedEvent struct { // CDEventsReader implementation func (e BranchDeletedEvent) GetType() CDEventType { - return BranchDeletedEventV1 + return BranchDeletedEventV0_1_2 } func (e BranchDeletedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *BranchDeletedEvent) SetSubjectRepository(repository *Reference) { func NewBranchDeletedEvent() (*BranchDeletedEvent, error) { e := &BranchDeletedEvent{ Context: Context{ - Type: BranchDeletedEventV1.String(), + Type: BranchDeletedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: BranchDeletedSubject{ diff --git a/pkg/api/zz_buildfinished.go b/pkg/api/zz_buildfinished_0_1_1.go similarity index 97% rename from pkg/api/zz_buildfinished.go rename to pkg/api/zz_buildfinished_0_1_1.go index 8f7f6eb..26268c0 100644 --- a/pkg/api/zz_buildfinished.go +++ b/pkg/api/zz_buildfinished_0_1_1.go @@ -29,7 +29,7 @@ var buildfinishedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sch var ( // BuildFinished event v0.1.1 - BuildFinishedEventV1 CDEventType = CDEventType{ + BuildFinishedEventV0_1_1 CDEventType = CDEventType{ Subject: "build", Predicate: "finished", Version: "0.1.1", @@ -58,7 +58,7 @@ type BuildFinishedEvent struct { // CDEventsReader implementation func (e BuildFinishedEvent) GetType() CDEventType { - return BuildFinishedEventV1 + return BuildFinishedEventV0_1_1 } func (e BuildFinishedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *BuildFinishedEvent) SetSubjectArtifactId(artifactId string) { func NewBuildFinishedEvent() (*BuildFinishedEvent, error) { e := &BuildFinishedEvent{ Context: Context{ - Type: BuildFinishedEventV1.String(), + Type: BuildFinishedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: BuildFinishedSubject{ diff --git a/pkg/api/zz_buildqueued.go b/pkg/api/zz_buildqueued_0_1_1.go similarity index 97% rename from pkg/api/zz_buildqueued.go rename to pkg/api/zz_buildqueued_0_1_1.go index a515078..ad95747 100644 --- a/pkg/api/zz_buildqueued.go +++ b/pkg/api/zz_buildqueued_0_1_1.go @@ -29,7 +29,7 @@ var buildqueuedschema = `{"$schema":"https://json-schema.org/draft/2020-12/schem var ( // BuildQueued event v0.1.1 - BuildQueuedEventV1 CDEventType = CDEventType{ + BuildQueuedEventV0_1_1 CDEventType = CDEventType{ Subject: "build", Predicate: "queued", Version: "0.1.1", @@ -57,7 +57,7 @@ type BuildQueuedEvent struct { // CDEventsReader implementation func (e BuildQueuedEvent) GetType() CDEventType { - return BuildQueuedEventV1 + return BuildQueuedEventV0_1_1 } func (e BuildQueuedEvent) GetVersion() string { @@ -151,7 +151,7 @@ func (e BuildQueuedEvent) GetSchema() (string, string) { func NewBuildQueuedEvent() (*BuildQueuedEvent, error) { e := &BuildQueuedEvent{ Context: Context{ - Type: BuildQueuedEventV1.String(), + Type: BuildQueuedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: BuildQueuedSubject{ diff --git a/pkg/api/zz_buildstarted.go b/pkg/api/zz_buildstarted_0_1_1.go similarity index 97% rename from pkg/api/zz_buildstarted.go rename to pkg/api/zz_buildstarted_0_1_1.go index eb651c0..267e083 100644 --- a/pkg/api/zz_buildstarted.go +++ b/pkg/api/zz_buildstarted_0_1_1.go @@ -29,7 +29,7 @@ var buildstartedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sche var ( // BuildStarted event v0.1.1 - BuildStartedEventV1 CDEventType = CDEventType{ + BuildStartedEventV0_1_1 CDEventType = CDEventType{ Subject: "build", Predicate: "started", Version: "0.1.1", @@ -57,7 +57,7 @@ type BuildStartedEvent struct { // CDEventsReader implementation func (e BuildStartedEvent) GetType() CDEventType { - return BuildStartedEventV1 + return BuildStartedEventV0_1_1 } func (e BuildStartedEvent) GetVersion() string { @@ -151,7 +151,7 @@ func (e BuildStartedEvent) GetSchema() (string, string) { func NewBuildStartedEvent() (*BuildStartedEvent, error) { e := &BuildStartedEvent{ Context: Context{ - Type: BuildStartedEventV1.String(), + Type: BuildStartedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: BuildStartedSubject{ diff --git a/pkg/api/zz_changeabandoned.go b/pkg/api/zz_changeabandoned_0_1_2.go similarity index 97% rename from pkg/api/zz_changeabandoned.go rename to pkg/api/zz_changeabandoned_0_1_2.go index 892416c..f4c56c3 100644 --- a/pkg/api/zz_changeabandoned.go +++ b/pkg/api/zz_changeabandoned_0_1_2.go @@ -29,7 +29,7 @@ var changeabandonedschema = `{"$schema":"https://json-schema.org/draft/2020-12/s var ( // ChangeAbandoned event v0.1.2 - ChangeAbandonedEventV1 CDEventType = CDEventType{ + ChangeAbandonedEventV0_1_2 CDEventType = CDEventType{ Subject: "change", Predicate: "abandoned", Version: "0.1.2", @@ -58,7 +58,7 @@ type ChangeAbandonedEvent struct { // CDEventsReader implementation func (e ChangeAbandonedEvent) GetType() CDEventType { - return ChangeAbandonedEventV1 + return ChangeAbandonedEventV0_1_2 } func (e ChangeAbandonedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ChangeAbandonedEvent) SetSubjectRepository(repository *Reference) { func NewChangeAbandonedEvent() (*ChangeAbandonedEvent, error) { e := &ChangeAbandonedEvent{ Context: Context{ - Type: ChangeAbandonedEventV1.String(), + Type: ChangeAbandonedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: ChangeAbandonedSubject{ diff --git a/pkg/api/zz_changecreated.go b/pkg/api/zz_changecreated_0_1_2.go similarity index 97% rename from pkg/api/zz_changecreated.go rename to pkg/api/zz_changecreated_0_1_2.go index fd2c656..6f34de4 100644 --- a/pkg/api/zz_changecreated.go +++ b/pkg/api/zz_changecreated_0_1_2.go @@ -29,7 +29,7 @@ var changecreatedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sch var ( // ChangeCreated event v0.1.2 - ChangeCreatedEventV1 CDEventType = CDEventType{ + ChangeCreatedEventV0_1_2 CDEventType = CDEventType{ Subject: "change", Predicate: "created", Version: "0.1.2", @@ -58,7 +58,7 @@ type ChangeCreatedEvent struct { // CDEventsReader implementation func (e ChangeCreatedEvent) GetType() CDEventType { - return ChangeCreatedEventV1 + return ChangeCreatedEventV0_1_2 } func (e ChangeCreatedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ChangeCreatedEvent) SetSubjectRepository(repository *Reference) { func NewChangeCreatedEvent() (*ChangeCreatedEvent, error) { e := &ChangeCreatedEvent{ Context: Context{ - Type: ChangeCreatedEventV1.String(), + Type: ChangeCreatedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: ChangeCreatedSubject{ diff --git a/pkg/api/zz_changemerged.go b/pkg/api/zz_changemerged_0_1_2.go similarity index 97% rename from pkg/api/zz_changemerged.go rename to pkg/api/zz_changemerged_0_1_2.go index f893840..9a5cbe4 100644 --- a/pkg/api/zz_changemerged.go +++ b/pkg/api/zz_changemerged_0_1_2.go @@ -29,7 +29,7 @@ var changemergedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sche var ( // ChangeMerged event v0.1.2 - ChangeMergedEventV1 CDEventType = CDEventType{ + ChangeMergedEventV0_1_2 CDEventType = CDEventType{ Subject: "change", Predicate: "merged", Version: "0.1.2", @@ -58,7 +58,7 @@ type ChangeMergedEvent struct { // CDEventsReader implementation func (e ChangeMergedEvent) GetType() CDEventType { - return ChangeMergedEventV1 + return ChangeMergedEventV0_1_2 } func (e ChangeMergedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ChangeMergedEvent) SetSubjectRepository(repository *Reference) { func NewChangeMergedEvent() (*ChangeMergedEvent, error) { e := &ChangeMergedEvent{ Context: Context{ - Type: ChangeMergedEventV1.String(), + Type: ChangeMergedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: ChangeMergedSubject{ diff --git a/pkg/api/zz_changereviewed.go b/pkg/api/zz_changereviewed_0_1_2.go similarity index 97% rename from pkg/api/zz_changereviewed.go rename to pkg/api/zz_changereviewed_0_1_2.go index b570a7d..0c5a1b0 100644 --- a/pkg/api/zz_changereviewed.go +++ b/pkg/api/zz_changereviewed_0_1_2.go @@ -29,7 +29,7 @@ var changereviewedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sc var ( // ChangeReviewed event v0.1.2 - ChangeReviewedEventV1 CDEventType = CDEventType{ + ChangeReviewedEventV0_1_2 CDEventType = CDEventType{ Subject: "change", Predicate: "reviewed", Version: "0.1.2", @@ -58,7 +58,7 @@ type ChangeReviewedEvent struct { // CDEventsReader implementation func (e ChangeReviewedEvent) GetType() CDEventType { - return ChangeReviewedEventV1 + return ChangeReviewedEventV0_1_2 } func (e ChangeReviewedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ChangeReviewedEvent) SetSubjectRepository(repository *Reference) { func NewChangeReviewedEvent() (*ChangeReviewedEvent, error) { e := &ChangeReviewedEvent{ Context: Context{ - Type: ChangeReviewedEventV1.String(), + Type: ChangeReviewedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: ChangeReviewedSubject{ diff --git a/pkg/api/zz_changeupdated.go b/pkg/api/zz_changeupdated_0_1_2.go similarity index 97% rename from pkg/api/zz_changeupdated.go rename to pkg/api/zz_changeupdated_0_1_2.go index 0402fd4..3a30959 100644 --- a/pkg/api/zz_changeupdated.go +++ b/pkg/api/zz_changeupdated_0_1_2.go @@ -29,7 +29,7 @@ var changeupdatedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sch var ( // ChangeUpdated event v0.1.2 - ChangeUpdatedEventV1 CDEventType = CDEventType{ + ChangeUpdatedEventV0_1_2 CDEventType = CDEventType{ Subject: "change", Predicate: "updated", Version: "0.1.2", @@ -58,7 +58,7 @@ type ChangeUpdatedEvent struct { // CDEventsReader implementation func (e ChangeUpdatedEvent) GetType() CDEventType { - return ChangeUpdatedEventV1 + return ChangeUpdatedEventV0_1_2 } func (e ChangeUpdatedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ChangeUpdatedEvent) SetSubjectRepository(repository *Reference) { func NewChangeUpdatedEvent() (*ChangeUpdatedEvent, error) { e := &ChangeUpdatedEvent{ Context: Context{ - Type: ChangeUpdatedEventV1.String(), + Type: ChangeUpdatedEventV0_1_2.String(), Version: CDEventsSpecVersion, }, Subject: ChangeUpdatedSubject{ diff --git a/pkg/api/zz_environmentcreated.go b/pkg/api/zz_environmentcreated_0_1_1.go similarity index 97% rename from pkg/api/zz_environmentcreated.go rename to pkg/api/zz_environmentcreated_0_1_1.go index 33715b5..3c287fd 100644 --- a/pkg/api/zz_environmentcreated.go +++ b/pkg/api/zz_environmentcreated_0_1_1.go @@ -29,7 +29,7 @@ var environmentcreatedschema = `{"$schema":"https://json-schema.org/draft/2020-1 var ( // EnvironmentCreated event v0.1.1 - EnvironmentCreatedEventV1 CDEventType = CDEventType{ + EnvironmentCreatedEventV0_1_1 CDEventType = CDEventType{ Subject: "environment", Predicate: "created", Version: "0.1.1", @@ -60,7 +60,7 @@ type EnvironmentCreatedEvent struct { // CDEventsReader implementation func (e EnvironmentCreatedEvent) GetType() CDEventType { - return EnvironmentCreatedEventV1 + return EnvironmentCreatedEventV0_1_1 } func (e EnvironmentCreatedEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *EnvironmentCreatedEvent) SetSubjectUrl(url string) { func NewEnvironmentCreatedEvent() (*EnvironmentCreatedEvent, error) { e := &EnvironmentCreatedEvent{ Context: Context{ - Type: EnvironmentCreatedEventV1.String(), + Type: EnvironmentCreatedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: EnvironmentCreatedSubject{ diff --git a/pkg/api/zz_environmentdeleted.go b/pkg/api/zz_environmentdeleted_0_1_1.go similarity index 97% rename from pkg/api/zz_environmentdeleted.go rename to pkg/api/zz_environmentdeleted_0_1_1.go index eaeb28f..f10c6d1 100644 --- a/pkg/api/zz_environmentdeleted.go +++ b/pkg/api/zz_environmentdeleted_0_1_1.go @@ -29,7 +29,7 @@ var environmentdeletedschema = `{"$schema":"https://json-schema.org/draft/2020-1 var ( // EnvironmentDeleted event v0.1.1 - EnvironmentDeletedEventV1 CDEventType = CDEventType{ + EnvironmentDeletedEventV0_1_1 CDEventType = CDEventType{ Subject: "environment", Predicate: "deleted", Version: "0.1.1", @@ -58,7 +58,7 @@ type EnvironmentDeletedEvent struct { // CDEventsReader implementation func (e EnvironmentDeletedEvent) GetType() CDEventType { - return EnvironmentDeletedEventV1 + return EnvironmentDeletedEventV0_1_1 } func (e EnvironmentDeletedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *EnvironmentDeletedEvent) SetSubjectName(name string) { func NewEnvironmentDeletedEvent() (*EnvironmentDeletedEvent, error) { e := &EnvironmentDeletedEvent{ Context: Context{ - Type: EnvironmentDeletedEventV1.String(), + Type: EnvironmentDeletedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: EnvironmentDeletedSubject{ diff --git a/pkg/api/zz_environmentmodified.go b/pkg/api/zz_environmentmodified_0_1_1.go similarity index 97% rename from pkg/api/zz_environmentmodified.go rename to pkg/api/zz_environmentmodified_0_1_1.go index 639d997..4c3332a 100644 --- a/pkg/api/zz_environmentmodified.go +++ b/pkg/api/zz_environmentmodified_0_1_1.go @@ -29,7 +29,7 @@ var environmentmodifiedschema = `{"$schema":"https://json-schema.org/draft/2020- var ( // EnvironmentModified event v0.1.1 - EnvironmentModifiedEventV1 CDEventType = CDEventType{ + EnvironmentModifiedEventV0_1_1 CDEventType = CDEventType{ Subject: "environment", Predicate: "modified", Version: "0.1.1", @@ -60,7 +60,7 @@ type EnvironmentModifiedEvent struct { // CDEventsReader implementation func (e EnvironmentModifiedEvent) GetType() CDEventType { - return EnvironmentModifiedEventV1 + return EnvironmentModifiedEventV0_1_1 } func (e EnvironmentModifiedEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *EnvironmentModifiedEvent) SetSubjectUrl(url string) { func NewEnvironmentModifiedEvent() (*EnvironmentModifiedEvent, error) { e := &EnvironmentModifiedEvent{ Context: Context{ - Type: EnvironmentModifiedEventV1.String(), + Type: EnvironmentModifiedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: EnvironmentModifiedSubject{ diff --git a/pkg/api/zz_factory_test.go b/pkg/api/zz_factory_test.go index f2336c1..0e031c8 100644 --- a/pkg/api/zz_factory_test.go +++ b/pkg/api/zz_factory_test.go @@ -24,10 +24,10 @@ func init() { tests = []testNewCDEventType{} tests = append(tests, testNewCDEventType{ name: "artifact packaged", - eventType: ArtifactPackagedEventV1.String(), + eventType: ArtifactPackagedEventV0_1_1.String(), expectedEvent: &ArtifactPackagedEvent{ Context: Context{ - Type: ArtifactPackagedEventV1.String(), + Type: ArtifactPackagedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -41,10 +41,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "artifact published", - eventType: ArtifactPublishedEventV1.String(), + eventType: ArtifactPublishedEventV0_1_1.String(), expectedEvent: &ArtifactPublishedEvent{ Context: Context{ - Type: ArtifactPublishedEventV1.String(), + Type: ArtifactPublishedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -58,10 +58,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "artifact signed", - eventType: ArtifactSignedEventV1.String(), + eventType: ArtifactSignedEventV0_1_0.String(), expectedEvent: &ArtifactSignedEvent{ Context: Context{ - Type: ArtifactSignedEventV1.String(), + Type: ArtifactSignedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -75,10 +75,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "branch created", - eventType: BranchCreatedEventV1.String(), + eventType: BranchCreatedEventV0_1_2.String(), expectedEvent: &BranchCreatedEvent{ Context: Context{ - Type: BranchCreatedEventV1.String(), + Type: BranchCreatedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -92,10 +92,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "branch deleted", - eventType: BranchDeletedEventV1.String(), + eventType: BranchDeletedEventV0_1_2.String(), expectedEvent: &BranchDeletedEvent{ Context: Context{ - Type: BranchDeletedEventV1.String(), + Type: BranchDeletedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -109,10 +109,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "build finished", - eventType: BuildFinishedEventV1.String(), + eventType: BuildFinishedEventV0_1_1.String(), expectedEvent: &BuildFinishedEvent{ Context: Context{ - Type: BuildFinishedEventV1.String(), + Type: BuildFinishedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -126,10 +126,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "build queued", - eventType: BuildQueuedEventV1.String(), + eventType: BuildQueuedEventV0_1_1.String(), expectedEvent: &BuildQueuedEvent{ Context: Context{ - Type: BuildQueuedEventV1.String(), + Type: BuildQueuedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -143,10 +143,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "build started", - eventType: BuildStartedEventV1.String(), + eventType: BuildStartedEventV0_1_1.String(), expectedEvent: &BuildStartedEvent{ Context: Context{ - Type: BuildStartedEventV1.String(), + Type: BuildStartedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -160,10 +160,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "change abandoned", - eventType: ChangeAbandonedEventV1.String(), + eventType: ChangeAbandonedEventV0_1_2.String(), expectedEvent: &ChangeAbandonedEvent{ Context: Context{ - Type: ChangeAbandonedEventV1.String(), + Type: ChangeAbandonedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -177,10 +177,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "change created", - eventType: ChangeCreatedEventV1.String(), + eventType: ChangeCreatedEventV0_1_2.String(), expectedEvent: &ChangeCreatedEvent{ Context: Context{ - Type: ChangeCreatedEventV1.String(), + Type: ChangeCreatedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -194,10 +194,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "change merged", - eventType: ChangeMergedEventV1.String(), + eventType: ChangeMergedEventV0_1_2.String(), expectedEvent: &ChangeMergedEvent{ Context: Context{ - Type: ChangeMergedEventV1.String(), + Type: ChangeMergedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -211,10 +211,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "change reviewed", - eventType: ChangeReviewedEventV1.String(), + eventType: ChangeReviewedEventV0_1_2.String(), expectedEvent: &ChangeReviewedEvent{ Context: Context{ - Type: ChangeReviewedEventV1.String(), + Type: ChangeReviewedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -228,10 +228,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "change updated", - eventType: ChangeUpdatedEventV1.String(), + eventType: ChangeUpdatedEventV0_1_2.String(), expectedEvent: &ChangeUpdatedEvent{ Context: Context{ - Type: ChangeUpdatedEventV1.String(), + Type: ChangeUpdatedEventV0_1_2.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -245,10 +245,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "environment created", - eventType: EnvironmentCreatedEventV1.String(), + eventType: EnvironmentCreatedEventV0_1_1.String(), expectedEvent: &EnvironmentCreatedEvent{ Context: Context{ - Type: EnvironmentCreatedEventV1.String(), + Type: EnvironmentCreatedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -262,10 +262,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "environment deleted", - eventType: EnvironmentDeletedEventV1.String(), + eventType: EnvironmentDeletedEventV0_1_1.String(), expectedEvent: &EnvironmentDeletedEvent{ Context: Context{ - Type: EnvironmentDeletedEventV1.String(), + Type: EnvironmentDeletedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -279,10 +279,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "environment modified", - eventType: EnvironmentModifiedEventV1.String(), + eventType: EnvironmentModifiedEventV0_1_1.String(), expectedEvent: &EnvironmentModifiedEvent{ Context: Context{ - Type: EnvironmentModifiedEventV1.String(), + Type: EnvironmentModifiedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -296,10 +296,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "incident detected", - eventType: IncidentDetectedEventV1.String(), + eventType: IncidentDetectedEventV0_1_0.String(), expectedEvent: &IncidentDetectedEvent{ Context: Context{ - Type: IncidentDetectedEventV1.String(), + Type: IncidentDetectedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -313,10 +313,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "incident reported", - eventType: IncidentReportedEventV1.String(), + eventType: IncidentReportedEventV0_1_0.String(), expectedEvent: &IncidentReportedEvent{ Context: Context{ - Type: IncidentReportedEventV1.String(), + Type: IncidentReportedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -330,10 +330,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "incident resolved", - eventType: IncidentResolvedEventV1.String(), + eventType: IncidentResolvedEventV0_1_0.String(), expectedEvent: &IncidentResolvedEvent{ Context: Context{ - Type: IncidentResolvedEventV1.String(), + Type: IncidentResolvedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -347,10 +347,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "pipelinerun finished", - eventType: PipelineRunFinishedEventV1.String(), + eventType: PipelineRunFinishedEventV0_1_1.String(), expectedEvent: &PipelineRunFinishedEvent{ Context: Context{ - Type: PipelineRunFinishedEventV1.String(), + Type: PipelineRunFinishedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -364,10 +364,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "pipelinerun queued", - eventType: PipelineRunQueuedEventV1.String(), + eventType: PipelineRunQueuedEventV0_1_1.String(), expectedEvent: &PipelineRunQueuedEvent{ Context: Context{ - Type: PipelineRunQueuedEventV1.String(), + Type: PipelineRunQueuedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -381,10 +381,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "pipelinerun started", - eventType: PipelineRunStartedEventV1.String(), + eventType: PipelineRunStartedEventV0_1_1.String(), expectedEvent: &PipelineRunStartedEvent{ Context: Context{ - Type: PipelineRunStartedEventV1.String(), + Type: PipelineRunStartedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -398,10 +398,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "repository created", - eventType: RepositoryCreatedEventV1.String(), + eventType: RepositoryCreatedEventV0_1_1.String(), expectedEvent: &RepositoryCreatedEvent{ Context: Context{ - Type: RepositoryCreatedEventV1.String(), + Type: RepositoryCreatedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -415,10 +415,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "repository deleted", - eventType: RepositoryDeletedEventV1.String(), + eventType: RepositoryDeletedEventV0_1_1.String(), expectedEvent: &RepositoryDeletedEvent{ Context: Context{ - Type: RepositoryDeletedEventV1.String(), + Type: RepositoryDeletedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -432,10 +432,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "repository modified", - eventType: RepositoryModifiedEventV1.String(), + eventType: RepositoryModifiedEventV0_1_1.String(), expectedEvent: &RepositoryModifiedEvent{ Context: Context{ - Type: RepositoryModifiedEventV1.String(), + Type: RepositoryModifiedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -449,10 +449,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "service deployed", - eventType: ServiceDeployedEventV1.String(), + eventType: ServiceDeployedEventV0_1_1.String(), expectedEvent: &ServiceDeployedEvent{ Context: Context{ - Type: ServiceDeployedEventV1.String(), + Type: ServiceDeployedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -466,10 +466,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "service published", - eventType: ServicePublishedEventV1.String(), + eventType: ServicePublishedEventV0_1_1.String(), expectedEvent: &ServicePublishedEvent{ Context: Context{ - Type: ServicePublishedEventV1.String(), + Type: ServicePublishedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -483,10 +483,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "service removed", - eventType: ServiceRemovedEventV1.String(), + eventType: ServiceRemovedEventV0_1_1.String(), expectedEvent: &ServiceRemovedEvent{ Context: Context{ - Type: ServiceRemovedEventV1.String(), + Type: ServiceRemovedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -500,10 +500,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "service rolledback", - eventType: ServiceRolledbackEventV1.String(), + eventType: ServiceRolledbackEventV0_1_1.String(), expectedEvent: &ServiceRolledbackEvent{ Context: Context{ - Type: ServiceRolledbackEventV1.String(), + Type: ServiceRolledbackEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -517,10 +517,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "service upgraded", - eventType: ServiceUpgradedEventV1.String(), + eventType: ServiceUpgradedEventV0_1_1.String(), expectedEvent: &ServiceUpgradedEvent{ Context: Context{ - Type: ServiceUpgradedEventV1.String(), + Type: ServiceUpgradedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -534,10 +534,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "taskrun finished", - eventType: TaskRunFinishedEventV1.String(), + eventType: TaskRunFinishedEventV0_1_1.String(), expectedEvent: &TaskRunFinishedEvent{ Context: Context{ - Type: TaskRunFinishedEventV1.String(), + Type: TaskRunFinishedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -551,10 +551,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "taskrun started", - eventType: TaskRunStartedEventV1.String(), + eventType: TaskRunStartedEventV0_1_1.String(), expectedEvent: &TaskRunStartedEvent{ Context: Context{ - Type: TaskRunStartedEventV1.String(), + Type: TaskRunStartedEventV0_1_1.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -568,10 +568,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testcaserun finished", - eventType: TestCaseRunFinishedEventV1.String(), + eventType: TestCaseRunFinishedEventV0_1_0.String(), expectedEvent: &TestCaseRunFinishedEvent{ Context: Context{ - Type: TestCaseRunFinishedEventV1.String(), + Type: TestCaseRunFinishedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -585,10 +585,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testcaserun queued", - eventType: TestCaseRunQueuedEventV1.String(), + eventType: TestCaseRunQueuedEventV0_1_0.String(), expectedEvent: &TestCaseRunQueuedEvent{ Context: Context{ - Type: TestCaseRunQueuedEventV1.String(), + Type: TestCaseRunQueuedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -602,10 +602,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testcaserun started", - eventType: TestCaseRunStartedEventV1.String(), + eventType: TestCaseRunStartedEventV0_1_0.String(), expectedEvent: &TestCaseRunStartedEvent{ Context: Context{ - Type: TestCaseRunStartedEventV1.String(), + Type: TestCaseRunStartedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -619,10 +619,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testoutput published", - eventType: TestOutputPublishedEventV1.String(), + eventType: TestOutputPublishedEventV0_1_0.String(), expectedEvent: &TestOutputPublishedEvent{ Context: Context{ - Type: TestOutputPublishedEventV1.String(), + Type: TestOutputPublishedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -636,10 +636,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testsuiterun finished", - eventType: TestSuiteRunFinishedEventV1.String(), + eventType: TestSuiteRunFinishedEventV0_1_0.String(), expectedEvent: &TestSuiteRunFinishedEvent{ Context: Context{ - Type: TestSuiteRunFinishedEventV1.String(), + Type: TestSuiteRunFinishedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -653,10 +653,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testsuiterun queued", - eventType: TestSuiteRunQueuedEventV1.String(), + eventType: TestSuiteRunQueuedEventV0_1_0.String(), expectedEvent: &TestSuiteRunQueuedEvent{ Context: Context{ - Type: TestSuiteRunQueuedEventV1.String(), + Type: TestSuiteRunQueuedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, @@ -670,10 +670,10 @@ func init() { }) tests = append(tests, testNewCDEventType{ name: "testsuiterun started", - eventType: TestSuiteRunStartedEventV1.String(), + eventType: TestSuiteRunStartedEventV0_1_0.String(), expectedEvent: &TestSuiteRunStartedEvent{ Context: Context{ - Type: TestSuiteRunStartedEventV1.String(), + Type: TestSuiteRunStartedEventV0_1_0.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, diff --git a/pkg/api/zz_incidentdetected.go b/pkg/api/zz_incidentdetected_0_1_0.go similarity index 97% rename from pkg/api/zz_incidentdetected.go rename to pkg/api/zz_incidentdetected_0_1_0.go index ec7daa6..8e1dd51 100644 --- a/pkg/api/zz_incidentdetected.go +++ b/pkg/api/zz_incidentdetected_0_1_0.go @@ -29,7 +29,7 @@ var incidentdetectedschema = `{"$schema":"https://json-schema.org/draft/2020-12/ var ( // IncidentDetected event v0.1.0 - IncidentDetectedEventV1 CDEventType = CDEventType{ + IncidentDetectedEventV0_1_0 CDEventType = CDEventType{ Subject: "incident", Predicate: "detected", Version: "0.1.0", @@ -64,7 +64,7 @@ type IncidentDetectedEvent struct { // CDEventsReader implementation func (e IncidentDetectedEvent) GetType() CDEventType { - return IncidentDetectedEventV1 + return IncidentDetectedEventV0_1_0 } func (e IncidentDetectedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *IncidentDetectedEvent) SetSubjectService(service *Reference) { func NewIncidentDetectedEvent() (*IncidentDetectedEvent, error) { e := &IncidentDetectedEvent{ Context: Context{ - Type: IncidentDetectedEventV1.String(), + Type: IncidentDetectedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: IncidentDetectedSubject{ diff --git a/pkg/api/zz_incidentreported.go b/pkg/api/zz_incidentreported_0_1_0.go similarity index 97% rename from pkg/api/zz_incidentreported.go rename to pkg/api/zz_incidentreported_0_1_0.go index 4f73d77..ae76f0c 100644 --- a/pkg/api/zz_incidentreported.go +++ b/pkg/api/zz_incidentreported_0_1_0.go @@ -29,7 +29,7 @@ var incidentreportedschema = `{"$schema":"https://json-schema.org/draft/2020-12/ var ( // IncidentReported event v0.1.0 - IncidentReportedEventV1 CDEventType = CDEventType{ + IncidentReportedEventV0_1_0 CDEventType = CDEventType{ Subject: "incident", Predicate: "reported", Version: "0.1.0", @@ -66,7 +66,7 @@ type IncidentReportedEvent struct { // CDEventsReader implementation func (e IncidentReportedEvent) GetType() CDEventType { - return IncidentReportedEventV1 + return IncidentReportedEventV0_1_0 } func (e IncidentReportedEvent) GetVersion() string { @@ -180,7 +180,7 @@ func (e *IncidentReportedEvent) SetSubjectTicketURI(ticketURI string) { func NewIncidentReportedEvent() (*IncidentReportedEvent, error) { e := &IncidentReportedEvent{ Context: Context{ - Type: IncidentReportedEventV1.String(), + Type: IncidentReportedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: IncidentReportedSubject{ diff --git a/pkg/api/zz_incidentresolved.go b/pkg/api/zz_incidentresolved_0_1_0.go similarity index 97% rename from pkg/api/zz_incidentresolved.go rename to pkg/api/zz_incidentresolved_0_1_0.go index cd8df2f..41b698f 100644 --- a/pkg/api/zz_incidentresolved.go +++ b/pkg/api/zz_incidentresolved_0_1_0.go @@ -29,7 +29,7 @@ var incidentresolvedschema = `{"$schema":"https://json-schema.org/draft/2020-12/ var ( // IncidentResolved event v0.1.0 - IncidentResolvedEventV1 CDEventType = CDEventType{ + IncidentResolvedEventV0_1_0 CDEventType = CDEventType{ Subject: "incident", Predicate: "resolved", Version: "0.1.0", @@ -64,7 +64,7 @@ type IncidentResolvedEvent struct { // CDEventsReader implementation func (e IncidentResolvedEvent) GetType() CDEventType { - return IncidentResolvedEventV1 + return IncidentResolvedEventV0_1_0 } func (e IncidentResolvedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *IncidentResolvedEvent) SetSubjectService(service *Reference) { func NewIncidentResolvedEvent() (*IncidentResolvedEvent, error) { e := &IncidentResolvedEvent{ Context: Context{ - Type: IncidentResolvedEventV1.String(), + Type: IncidentResolvedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: IncidentResolvedSubject{ diff --git a/pkg/api/zz_pipelinerunfinished.go b/pkg/api/zz_pipelinerunfinished_0_1_1.go similarity index 97% rename from pkg/api/zz_pipelinerunfinished.go rename to pkg/api/zz_pipelinerunfinished_0_1_1.go index e7c3739..b9dadbd 100644 --- a/pkg/api/zz_pipelinerunfinished.go +++ b/pkg/api/zz_pipelinerunfinished_0_1_1.go @@ -29,7 +29,7 @@ var pipelinerunfinishedschema = `{"$schema":"https://json-schema.org/draft/2020- var ( // PipelineRunFinished event v0.1.1 - PipelineRunFinishedEventV1 CDEventType = CDEventType{ + PipelineRunFinishedEventV0_1_1 CDEventType = CDEventType{ Subject: "pipelinerun", Predicate: "finished", Version: "0.1.1", @@ -64,7 +64,7 @@ type PipelineRunFinishedEvent struct { // CDEventsReader implementation func (e PipelineRunFinishedEvent) GetType() CDEventType { - return PipelineRunFinishedEventV1 + return PipelineRunFinishedEventV0_1_1 } func (e PipelineRunFinishedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *PipelineRunFinishedEvent) SetSubjectUrl(url string) { func NewPipelineRunFinishedEvent() (*PipelineRunFinishedEvent, error) { e := &PipelineRunFinishedEvent{ Context: Context{ - Type: PipelineRunFinishedEventV1.String(), + Type: PipelineRunFinishedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: PipelineRunFinishedSubject{ diff --git a/pkg/api/zz_pipelinerunqueued.go b/pkg/api/zz_pipelinerunqueued_0_1_1.go similarity index 97% rename from pkg/api/zz_pipelinerunqueued.go rename to pkg/api/zz_pipelinerunqueued_0_1_1.go index 4b8bb15..8701b85 100644 --- a/pkg/api/zz_pipelinerunqueued.go +++ b/pkg/api/zz_pipelinerunqueued_0_1_1.go @@ -29,7 +29,7 @@ var pipelinerunqueuedschema = `{"$schema":"https://json-schema.org/draft/2020-12 var ( // PipelineRunQueued event v0.1.1 - PipelineRunQueuedEventV1 CDEventType = CDEventType{ + PipelineRunQueuedEventV0_1_1 CDEventType = CDEventType{ Subject: "pipelinerun", Predicate: "queued", Version: "0.1.1", @@ -60,7 +60,7 @@ type PipelineRunQueuedEvent struct { // CDEventsReader implementation func (e PipelineRunQueuedEvent) GetType() CDEventType { - return PipelineRunQueuedEventV1 + return PipelineRunQueuedEventV0_1_1 } func (e PipelineRunQueuedEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *PipelineRunQueuedEvent) SetSubjectUrl(url string) { func NewPipelineRunQueuedEvent() (*PipelineRunQueuedEvent, error) { e := &PipelineRunQueuedEvent{ Context: Context{ - Type: PipelineRunQueuedEventV1.String(), + Type: PipelineRunQueuedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: PipelineRunQueuedSubject{ diff --git a/pkg/api/zz_pipelinerunstarted.go b/pkg/api/zz_pipelinerunstarted_0_1_1.go similarity index 97% rename from pkg/api/zz_pipelinerunstarted.go rename to pkg/api/zz_pipelinerunstarted_0_1_1.go index e51c13c..bead272 100644 --- a/pkg/api/zz_pipelinerunstarted.go +++ b/pkg/api/zz_pipelinerunstarted_0_1_1.go @@ -29,7 +29,7 @@ var pipelinerunstartedschema = `{"$schema":"https://json-schema.org/draft/2020-1 var ( // PipelineRunStarted event v0.1.1 - PipelineRunStartedEventV1 CDEventType = CDEventType{ + PipelineRunStartedEventV0_1_1 CDEventType = CDEventType{ Subject: "pipelinerun", Predicate: "started", Version: "0.1.1", @@ -60,7 +60,7 @@ type PipelineRunStartedEvent struct { // CDEventsReader implementation func (e PipelineRunStartedEvent) GetType() CDEventType { - return PipelineRunStartedEventV1 + return PipelineRunStartedEventV0_1_1 } func (e PipelineRunStartedEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *PipelineRunStartedEvent) SetSubjectUrl(url string) { func NewPipelineRunStartedEvent() (*PipelineRunStartedEvent, error) { e := &PipelineRunStartedEvent{ Context: Context{ - Type: PipelineRunStartedEventV1.String(), + Type: PipelineRunStartedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: PipelineRunStartedSubject{ diff --git a/pkg/api/zz_repositorycreated.go b/pkg/api/zz_repositorycreated_0_1_1.go similarity index 97% rename from pkg/api/zz_repositorycreated.go rename to pkg/api/zz_repositorycreated_0_1_1.go index 4a440b1..a24b43d 100644 --- a/pkg/api/zz_repositorycreated.go +++ b/pkg/api/zz_repositorycreated_0_1_1.go @@ -29,7 +29,7 @@ var repositorycreatedschema = `{"$schema":"https://json-schema.org/draft/2020-12 var ( // RepositoryCreated event v0.1.1 - RepositoryCreatedEventV1 CDEventType = CDEventType{ + RepositoryCreatedEventV0_1_1 CDEventType = CDEventType{ Subject: "repository", Predicate: "created", Version: "0.1.1", @@ -64,7 +64,7 @@ type RepositoryCreatedEvent struct { // CDEventsReader implementation func (e RepositoryCreatedEvent) GetType() CDEventType { - return RepositoryCreatedEventV1 + return RepositoryCreatedEventV0_1_1 } func (e RepositoryCreatedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *RepositoryCreatedEvent) SetSubjectViewUrl(viewUrl string) { func NewRepositoryCreatedEvent() (*RepositoryCreatedEvent, error) { e := &RepositoryCreatedEvent{ Context: Context{ - Type: RepositoryCreatedEventV1.String(), + Type: RepositoryCreatedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: RepositoryCreatedSubject{ diff --git a/pkg/api/zz_repositorydeleted.go b/pkg/api/zz_repositorydeleted_0_1_1.go similarity index 97% rename from pkg/api/zz_repositorydeleted.go rename to pkg/api/zz_repositorydeleted_0_1_1.go index 9cafa1c..3e02197 100644 --- a/pkg/api/zz_repositorydeleted.go +++ b/pkg/api/zz_repositorydeleted_0_1_1.go @@ -29,7 +29,7 @@ var repositorydeletedschema = `{"$schema":"https://json-schema.org/draft/2020-12 var ( // RepositoryDeleted event v0.1.1 - RepositoryDeletedEventV1 CDEventType = CDEventType{ + RepositoryDeletedEventV0_1_1 CDEventType = CDEventType{ Subject: "repository", Predicate: "deleted", Version: "0.1.1", @@ -64,7 +64,7 @@ type RepositoryDeletedEvent struct { // CDEventsReader implementation func (e RepositoryDeletedEvent) GetType() CDEventType { - return RepositoryDeletedEventV1 + return RepositoryDeletedEventV0_1_1 } func (e RepositoryDeletedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *RepositoryDeletedEvent) SetSubjectViewUrl(viewUrl string) { func NewRepositoryDeletedEvent() (*RepositoryDeletedEvent, error) { e := &RepositoryDeletedEvent{ Context: Context{ - Type: RepositoryDeletedEventV1.String(), + Type: RepositoryDeletedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: RepositoryDeletedSubject{ diff --git a/pkg/api/zz_repositorymodified.go b/pkg/api/zz_repositorymodified_0_1_1.go similarity index 97% rename from pkg/api/zz_repositorymodified.go rename to pkg/api/zz_repositorymodified_0_1_1.go index 6128478..ffb8cd7 100644 --- a/pkg/api/zz_repositorymodified.go +++ b/pkg/api/zz_repositorymodified_0_1_1.go @@ -29,7 +29,7 @@ var repositorymodifiedschema = `{"$schema":"https://json-schema.org/draft/2020-1 var ( // RepositoryModified event v0.1.1 - RepositoryModifiedEventV1 CDEventType = CDEventType{ + RepositoryModifiedEventV0_1_1 CDEventType = CDEventType{ Subject: "repository", Predicate: "modified", Version: "0.1.1", @@ -64,7 +64,7 @@ type RepositoryModifiedEvent struct { // CDEventsReader implementation func (e RepositoryModifiedEvent) GetType() CDEventType { - return RepositoryModifiedEventV1 + return RepositoryModifiedEventV0_1_1 } func (e RepositoryModifiedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *RepositoryModifiedEvent) SetSubjectViewUrl(viewUrl string) { func NewRepositoryModifiedEvent() (*RepositoryModifiedEvent, error) { e := &RepositoryModifiedEvent{ Context: Context{ - Type: RepositoryModifiedEventV1.String(), + Type: RepositoryModifiedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: RepositoryModifiedSubject{ diff --git a/pkg/api/zz_servicedeployed.go b/pkg/api/zz_servicedeployed_0_1_1.go similarity index 97% rename from pkg/api/zz_servicedeployed.go rename to pkg/api/zz_servicedeployed_0_1_1.go index 78b3a2f..52c85b5 100644 --- a/pkg/api/zz_servicedeployed.go +++ b/pkg/api/zz_servicedeployed_0_1_1.go @@ -29,7 +29,7 @@ var servicedeployedschema = `{"$schema":"https://json-schema.org/draft/2020-12/s var ( // ServiceDeployed event v0.1.1 - ServiceDeployedEventV1 CDEventType = CDEventType{ + ServiceDeployedEventV0_1_1 CDEventType = CDEventType{ Subject: "service", Predicate: "deployed", Version: "0.1.1", @@ -60,7 +60,7 @@ type ServiceDeployedEvent struct { // CDEventsReader implementation func (e ServiceDeployedEvent) GetType() CDEventType { - return ServiceDeployedEventV1 + return ServiceDeployedEventV0_1_1 } func (e ServiceDeployedEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *ServiceDeployedEvent) SetSubjectEnvironment(environment *Reference) { func NewServiceDeployedEvent() (*ServiceDeployedEvent, error) { e := &ServiceDeployedEvent{ Context: Context{ - Type: ServiceDeployedEventV1.String(), + Type: ServiceDeployedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ServiceDeployedSubject{ diff --git a/pkg/api/zz_servicepublished.go b/pkg/api/zz_servicepublished_0_1_1.go similarity index 97% rename from pkg/api/zz_servicepublished.go rename to pkg/api/zz_servicepublished_0_1_1.go index a9d71c8..3fbcdb9 100644 --- a/pkg/api/zz_servicepublished.go +++ b/pkg/api/zz_servicepublished_0_1_1.go @@ -29,7 +29,7 @@ var servicepublishedschema = `{"$schema":"https://json-schema.org/draft/2020-12/ var ( // ServicePublished event v0.1.1 - ServicePublishedEventV1 CDEventType = CDEventType{ + ServicePublishedEventV0_1_1 CDEventType = CDEventType{ Subject: "service", Predicate: "published", Version: "0.1.1", @@ -58,7 +58,7 @@ type ServicePublishedEvent struct { // CDEventsReader implementation func (e ServicePublishedEvent) GetType() CDEventType { - return ServicePublishedEventV1 + return ServicePublishedEventV0_1_1 } func (e ServicePublishedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ServicePublishedEvent) SetSubjectEnvironment(environment *Reference) { func NewServicePublishedEvent() (*ServicePublishedEvent, error) { e := &ServicePublishedEvent{ Context: Context{ - Type: ServicePublishedEventV1.String(), + Type: ServicePublishedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ServicePublishedSubject{ diff --git a/pkg/api/zz_serviceremoved.go b/pkg/api/zz_serviceremoved_0_1_1.go similarity index 97% rename from pkg/api/zz_serviceremoved.go rename to pkg/api/zz_serviceremoved_0_1_1.go index 38a3094..29f73f4 100644 --- a/pkg/api/zz_serviceremoved.go +++ b/pkg/api/zz_serviceremoved_0_1_1.go @@ -29,7 +29,7 @@ var serviceremovedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sc var ( // ServiceRemoved event v0.1.1 - ServiceRemovedEventV1 CDEventType = CDEventType{ + ServiceRemovedEventV0_1_1 CDEventType = CDEventType{ Subject: "service", Predicate: "removed", Version: "0.1.1", @@ -58,7 +58,7 @@ type ServiceRemovedEvent struct { // CDEventsReader implementation func (e ServiceRemovedEvent) GetType() CDEventType { - return ServiceRemovedEventV1 + return ServiceRemovedEventV0_1_1 } func (e ServiceRemovedEvent) GetVersion() string { @@ -156,7 +156,7 @@ func (e *ServiceRemovedEvent) SetSubjectEnvironment(environment *Reference) { func NewServiceRemovedEvent() (*ServiceRemovedEvent, error) { e := &ServiceRemovedEvent{ Context: Context{ - Type: ServiceRemovedEventV1.String(), + Type: ServiceRemovedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ServiceRemovedSubject{ diff --git a/pkg/api/zz_servicerolledback.go b/pkg/api/zz_servicerolledback_0_1_1.go similarity index 97% rename from pkg/api/zz_servicerolledback.go rename to pkg/api/zz_servicerolledback_0_1_1.go index 723b160..00c1329 100644 --- a/pkg/api/zz_servicerolledback.go +++ b/pkg/api/zz_servicerolledback_0_1_1.go @@ -29,7 +29,7 @@ var servicerolledbackschema = `{"$schema":"https://json-schema.org/draft/2020-12 var ( // ServiceRolledback event v0.1.1 - ServiceRolledbackEventV1 CDEventType = CDEventType{ + ServiceRolledbackEventV0_1_1 CDEventType = CDEventType{ Subject: "service", Predicate: "rolledback", Version: "0.1.1", @@ -60,7 +60,7 @@ type ServiceRolledbackEvent struct { // CDEventsReader implementation func (e ServiceRolledbackEvent) GetType() CDEventType { - return ServiceRolledbackEventV1 + return ServiceRolledbackEventV0_1_1 } func (e ServiceRolledbackEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *ServiceRolledbackEvent) SetSubjectEnvironment(environment *Reference) { func NewServiceRolledbackEvent() (*ServiceRolledbackEvent, error) { e := &ServiceRolledbackEvent{ Context: Context{ - Type: ServiceRolledbackEventV1.String(), + Type: ServiceRolledbackEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ServiceRolledbackSubject{ diff --git a/pkg/api/zz_serviceupgraded.go b/pkg/api/zz_serviceupgraded_0_1_1.go similarity index 97% rename from pkg/api/zz_serviceupgraded.go rename to pkg/api/zz_serviceupgraded_0_1_1.go index 0939b08..2f0f4af 100644 --- a/pkg/api/zz_serviceupgraded.go +++ b/pkg/api/zz_serviceupgraded_0_1_1.go @@ -29,7 +29,7 @@ var serviceupgradedschema = `{"$schema":"https://json-schema.org/draft/2020-12/s var ( // ServiceUpgraded event v0.1.1 - ServiceUpgradedEventV1 CDEventType = CDEventType{ + ServiceUpgradedEventV0_1_1 CDEventType = CDEventType{ Subject: "service", Predicate: "upgraded", Version: "0.1.1", @@ -60,7 +60,7 @@ type ServiceUpgradedEvent struct { // CDEventsReader implementation func (e ServiceUpgradedEvent) GetType() CDEventType { - return ServiceUpgradedEventV1 + return ServiceUpgradedEventV0_1_1 } func (e ServiceUpgradedEvent) GetVersion() string { @@ -162,7 +162,7 @@ func (e *ServiceUpgradedEvent) SetSubjectEnvironment(environment *Reference) { func NewServiceUpgradedEvent() (*ServiceUpgradedEvent, error) { e := &ServiceUpgradedEvent{ Context: Context{ - Type: ServiceUpgradedEventV1.String(), + Type: ServiceUpgradedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: ServiceUpgradedSubject{ diff --git a/pkg/api/zz_taskrunfinished.go b/pkg/api/zz_taskrunfinished_0_1_1.go similarity index 97% rename from pkg/api/zz_taskrunfinished.go rename to pkg/api/zz_taskrunfinished_0_1_1.go index 8a0cd93..c454245 100644 --- a/pkg/api/zz_taskrunfinished.go +++ b/pkg/api/zz_taskrunfinished_0_1_1.go @@ -29,7 +29,7 @@ var taskrunfinishedschema = `{"$schema":"https://json-schema.org/draft/2020-12/s var ( // TaskRunFinished event v0.1.1 - TaskRunFinishedEventV1 CDEventType = CDEventType{ + TaskRunFinishedEventV0_1_1 CDEventType = CDEventType{ Subject: "taskrun", Predicate: "finished", Version: "0.1.1", @@ -66,7 +66,7 @@ type TaskRunFinishedEvent struct { // CDEventsReader implementation func (e TaskRunFinishedEvent) GetType() CDEventType { - return TaskRunFinishedEventV1 + return TaskRunFinishedEventV0_1_1 } func (e TaskRunFinishedEvent) GetVersion() string { @@ -180,7 +180,7 @@ func (e *TaskRunFinishedEvent) SetSubjectUrl(url string) { func NewTaskRunFinishedEvent() (*TaskRunFinishedEvent, error) { e := &TaskRunFinishedEvent{ Context: Context{ - Type: TaskRunFinishedEventV1.String(), + Type: TaskRunFinishedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: TaskRunFinishedSubject{ diff --git a/pkg/api/zz_taskrunstarted.go b/pkg/api/zz_taskrunstarted_0_1_1.go similarity index 97% rename from pkg/api/zz_taskrunstarted.go rename to pkg/api/zz_taskrunstarted_0_1_1.go index 3a6a8b3..5f2247d 100644 --- a/pkg/api/zz_taskrunstarted.go +++ b/pkg/api/zz_taskrunstarted_0_1_1.go @@ -29,7 +29,7 @@ var taskrunstartedschema = `{"$schema":"https://json-schema.org/draft/2020-12/sc var ( // TaskRunStarted event v0.1.1 - TaskRunStartedEventV1 CDEventType = CDEventType{ + TaskRunStartedEventV0_1_1 CDEventType = CDEventType{ Subject: "taskrun", Predicate: "started", Version: "0.1.1", @@ -62,7 +62,7 @@ type TaskRunStartedEvent struct { // CDEventsReader implementation func (e TaskRunStartedEvent) GetType() CDEventType { - return TaskRunStartedEventV1 + return TaskRunStartedEventV0_1_1 } func (e TaskRunStartedEvent) GetVersion() string { @@ -168,7 +168,7 @@ func (e *TaskRunStartedEvent) SetSubjectUrl(url string) { func NewTaskRunStartedEvent() (*TaskRunStartedEvent, error) { e := &TaskRunStartedEvent{ Context: Context{ - Type: TaskRunStartedEventV1.String(), + Type: TaskRunStartedEventV0_1_1.String(), Version: CDEventsSpecVersion, }, Subject: TaskRunStartedSubject{ diff --git a/pkg/api/zz_testcaserunfinished.go b/pkg/api/zz_testcaserunfinished_0_1_0.go similarity index 97% rename from pkg/api/zz_testcaserunfinished.go rename to pkg/api/zz_testcaserunfinished_0_1_0.go index 940e0b8..305ce70 100644 --- a/pkg/api/zz_testcaserunfinished.go +++ b/pkg/api/zz_testcaserunfinished_0_1_0.go @@ -29,7 +29,7 @@ var testcaserunfinishedschema = `{"$schema":"https://json-schema.org/draft/2020- var ( // TestCaseRunFinished event v0.1.0 - TestCaseRunFinishedEventV1 CDEventType = CDEventType{ + TestCaseRunFinishedEventV0_1_0 CDEventType = CDEventType{ Subject: "testcaserun", Predicate: "finished", Version: "0.1.0", @@ -68,7 +68,7 @@ type TestCaseRunFinishedEvent struct { // CDEventsReader implementation func (e TestCaseRunFinishedEvent) GetType() CDEventType { - return TestCaseRunFinishedEventV1 + return TestCaseRunFinishedEventV0_1_0 } func (e TestCaseRunFinishedEvent) GetVersion() string { @@ -186,7 +186,7 @@ func (e *TestCaseRunFinishedEvent) SetSubjectTestSuiteRun(testSuiteRun *Referenc func NewTestCaseRunFinishedEvent() (*TestCaseRunFinishedEvent, error) { e := &TestCaseRunFinishedEvent{ Context: Context{ - Type: TestCaseRunFinishedEventV1.String(), + Type: TestCaseRunFinishedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestCaseRunFinishedSubject{ diff --git a/pkg/api/zz_testcaserunqueued.go b/pkg/api/zz_testcaserunqueued_0_1_0.go similarity index 98% rename from pkg/api/zz_testcaserunqueued.go rename to pkg/api/zz_testcaserunqueued_0_1_0.go index ffacac8..c04a6e0 100644 --- a/pkg/api/zz_testcaserunqueued.go +++ b/pkg/api/zz_testcaserunqueued_0_1_0.go @@ -29,7 +29,7 @@ var testcaserunqueuedschema = `{"$schema":"https://json-schema.org/draft/2020-12 var ( // TestCaseRunQueued event v0.1.0 - TestCaseRunQueuedEventV1 CDEventType = CDEventType{ + TestCaseRunQueuedEventV0_1_0 CDEventType = CDEventType{ Subject: "testcaserun", Predicate: "queued", Version: "0.1.0", @@ -64,7 +64,7 @@ type TestCaseRunQueuedEvent struct { // CDEventsReader implementation func (e TestCaseRunQueuedEvent) GetType() CDEventType { - return TestCaseRunQueuedEventV1 + return TestCaseRunQueuedEventV0_1_0 } func (e TestCaseRunQueuedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *TestCaseRunQueuedEvent) SetSubjectTrigger(trigger *TestCaseRunQueuedSub func NewTestCaseRunQueuedEvent() (*TestCaseRunQueuedEvent, error) { e := &TestCaseRunQueuedEvent{ Context: Context{ - Type: TestCaseRunQueuedEventV1.String(), + Type: TestCaseRunQueuedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestCaseRunQueuedSubject{ diff --git a/pkg/api/zz_testcaserunstarted.go b/pkg/api/zz_testcaserunstarted_0_1_0.go similarity index 98% rename from pkg/api/zz_testcaserunstarted.go rename to pkg/api/zz_testcaserunstarted_0_1_0.go index 95114d5..30eb125 100644 --- a/pkg/api/zz_testcaserunstarted.go +++ b/pkg/api/zz_testcaserunstarted_0_1_0.go @@ -29,7 +29,7 @@ var testcaserunstartedschema = `{"$schema":"https://json-schema.org/draft/2020-1 var ( // TestCaseRunStarted event v0.1.0 - TestCaseRunStartedEventV1 CDEventType = CDEventType{ + TestCaseRunStartedEventV0_1_0 CDEventType = CDEventType{ Subject: "testcaserun", Predicate: "started", Version: "0.1.0", @@ -64,7 +64,7 @@ type TestCaseRunStartedEvent struct { // CDEventsReader implementation func (e TestCaseRunStartedEvent) GetType() CDEventType { - return TestCaseRunStartedEventV1 + return TestCaseRunStartedEventV0_1_0 } func (e TestCaseRunStartedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *TestCaseRunStartedEvent) SetSubjectTrigger(trigger *TestCaseRunStartedS func NewTestCaseRunStartedEvent() (*TestCaseRunStartedEvent, error) { e := &TestCaseRunStartedEvent{ Context: Context{ - Type: TestCaseRunStartedEventV1.String(), + Type: TestCaseRunStartedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestCaseRunStartedSubject{ diff --git a/pkg/api/zz_testoutputpublished.go b/pkg/api/zz_testoutputpublished_0_1_0.go similarity index 97% rename from pkg/api/zz_testoutputpublished.go rename to pkg/api/zz_testoutputpublished_0_1_0.go index c265c6d..902729c 100644 --- a/pkg/api/zz_testoutputpublished.go +++ b/pkg/api/zz_testoutputpublished_0_1_0.go @@ -29,7 +29,7 @@ var testoutputpublishedschema = `{"$schema":"https://json-schema.org/draft/2020- var ( // TestOutputPublished event v0.1.0 - TestOutputPublishedEventV1 CDEventType = CDEventType{ + TestOutputPublishedEventV0_1_0 CDEventType = CDEventType{ Subject: "testoutput", Predicate: "published", Version: "0.1.0", @@ -64,7 +64,7 @@ type TestOutputPublishedEvent struct { // CDEventsReader implementation func (e TestOutputPublishedEvent) GetType() CDEventType { - return TestOutputPublishedEventV1 + return TestOutputPublishedEventV0_1_0 } func (e TestOutputPublishedEvent) GetVersion() string { @@ -174,7 +174,7 @@ func (e *TestOutputPublishedEvent) SetSubjectUri(uri string) { func NewTestOutputPublishedEvent() (*TestOutputPublishedEvent, error) { e := &TestOutputPublishedEvent{ Context: Context{ - Type: TestOutputPublishedEventV1.String(), + Type: TestOutputPublishedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestOutputPublishedSubject{ diff --git a/pkg/api/zz_testsuiterunfinished.go b/pkg/api/zz_testsuiterunfinished_0_1_0.go similarity index 97% rename from pkg/api/zz_testsuiterunfinished.go rename to pkg/api/zz_testsuiterunfinished_0_1_0.go index 73c6771..342236c 100644 --- a/pkg/api/zz_testsuiterunfinished.go +++ b/pkg/api/zz_testsuiterunfinished_0_1_0.go @@ -29,7 +29,7 @@ var testsuiterunfinishedschema = `{"$schema":"https://json-schema.org/draft/2020 var ( // TestSuiteRunFinished event v0.1.0 - TestSuiteRunFinishedEventV1 CDEventType = CDEventType{ + TestSuiteRunFinishedEventV0_1_0 CDEventType = CDEventType{ Subject: "testsuiterun", Predicate: "finished", Version: "0.1.0", @@ -66,7 +66,7 @@ type TestSuiteRunFinishedEvent struct { // CDEventsReader implementation func (e TestSuiteRunFinishedEvent) GetType() CDEventType { - return TestSuiteRunFinishedEventV1 + return TestSuiteRunFinishedEventV0_1_0 } func (e TestSuiteRunFinishedEvent) GetVersion() string { @@ -180,7 +180,7 @@ func (e *TestSuiteRunFinishedEvent) SetSubjectTestSuite(testSuite *TestSuiteRunF func NewTestSuiteRunFinishedEvent() (*TestSuiteRunFinishedEvent, error) { e := &TestSuiteRunFinishedEvent{ Context: Context{ - Type: TestSuiteRunFinishedEventV1.String(), + Type: TestSuiteRunFinishedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestSuiteRunFinishedSubject{ diff --git a/pkg/api/zz_testsuiterunqueued.go b/pkg/api/zz_testsuiterunqueued_0_1_0.go similarity index 97% rename from pkg/api/zz_testsuiterunqueued.go rename to pkg/api/zz_testsuiterunqueued_0_1_0.go index 0d1a585..b223de8 100644 --- a/pkg/api/zz_testsuiterunqueued.go +++ b/pkg/api/zz_testsuiterunqueued_0_1_0.go @@ -29,7 +29,7 @@ var testsuiterunqueuedschema = `{"$schema":"https://json-schema.org/draft/2020-1 var ( // TestSuiteRunQueued event v0.1.0 - TestSuiteRunQueuedEventV1 CDEventType = CDEventType{ + TestSuiteRunQueuedEventV0_1_0 CDEventType = CDEventType{ Subject: "testsuiterun", Predicate: "queued", Version: "0.1.0", @@ -62,7 +62,7 @@ type TestSuiteRunQueuedEvent struct { // CDEventsReader implementation func (e TestSuiteRunQueuedEvent) GetType() CDEventType { - return TestSuiteRunQueuedEventV1 + return TestSuiteRunQueuedEventV0_1_0 } func (e TestSuiteRunQueuedEvent) GetVersion() string { @@ -168,7 +168,7 @@ func (e *TestSuiteRunQueuedEvent) SetSubjectTrigger(trigger *TestSuiteRunQueuedS func NewTestSuiteRunQueuedEvent() (*TestSuiteRunQueuedEvent, error) { e := &TestSuiteRunQueuedEvent{ Context: Context{ - Type: TestSuiteRunQueuedEventV1.String(), + Type: TestSuiteRunQueuedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestSuiteRunQueuedSubject{ diff --git a/pkg/api/zz_testsuiterunstarted.go b/pkg/api/zz_testsuiterunstarted_0_1_0.go similarity index 97% rename from pkg/api/zz_testsuiterunstarted.go rename to pkg/api/zz_testsuiterunstarted_0_1_0.go index 646939f..2325ae2 100644 --- a/pkg/api/zz_testsuiterunstarted.go +++ b/pkg/api/zz_testsuiterunstarted_0_1_0.go @@ -29,7 +29,7 @@ var testsuiterunstartedschema = `{"$schema":"https://json-schema.org/draft/2020- var ( // TestSuiteRunStarted event v0.1.0 - TestSuiteRunStartedEventV1 CDEventType = CDEventType{ + TestSuiteRunStartedEventV0_1_0 CDEventType = CDEventType{ Subject: "testsuiterun", Predicate: "started", Version: "0.1.0", @@ -62,7 +62,7 @@ type TestSuiteRunStartedEvent struct { // CDEventsReader implementation func (e TestSuiteRunStartedEvent) GetType() CDEventType { - return TestSuiteRunStartedEventV1 + return TestSuiteRunStartedEventV0_1_0 } func (e TestSuiteRunStartedEvent) GetVersion() string { @@ -168,7 +168,7 @@ func (e *TestSuiteRunStartedEvent) SetSubjectTrigger(trigger *TestSuiteRunStarte func NewTestSuiteRunStartedEvent() (*TestSuiteRunStartedEvent, error) { e := &TestSuiteRunStartedEvent{ Context: Context{ - Type: TestSuiteRunStartedEventV1.String(), + Type: TestSuiteRunStartedEventV0_1_0.String(), Version: CDEventsSpecVersion, }, Subject: TestSuiteRunStartedSubject{ diff --git a/pkg/api/zz_types.go b/pkg/api/zz_types.go index 4030d00..eb4199d 100644 --- a/pkg/api/zz_types.go +++ b/pkg/api/zz_types.go @@ -76,83 +76,83 @@ func init() { // This function can be used by users but it's meant mainly for testing purposes func NewCDEvent(eventType string) (CDEvent, error) { switch eventType { - case ArtifactPackagedEventV1.String(): + case ArtifactPackagedEventV0_1_1.String(): return NewArtifactPackagedEvent() - case ArtifactPublishedEventV1.String(): + case ArtifactPublishedEventV0_1_1.String(): return NewArtifactPublishedEvent() - case ArtifactSignedEventV1.String(): + case ArtifactSignedEventV0_1_0.String(): return NewArtifactSignedEvent() - case BranchCreatedEventV1.String(): + case BranchCreatedEventV0_1_2.String(): return NewBranchCreatedEvent() - case BranchDeletedEventV1.String(): + case BranchDeletedEventV0_1_2.String(): return NewBranchDeletedEvent() - case BuildFinishedEventV1.String(): + case BuildFinishedEventV0_1_1.String(): return NewBuildFinishedEvent() - case BuildQueuedEventV1.String(): + case BuildQueuedEventV0_1_1.String(): return NewBuildQueuedEvent() - case BuildStartedEventV1.String(): + case BuildStartedEventV0_1_1.String(): return NewBuildStartedEvent() - case ChangeAbandonedEventV1.String(): + case ChangeAbandonedEventV0_1_2.String(): return NewChangeAbandonedEvent() - case ChangeCreatedEventV1.String(): + case ChangeCreatedEventV0_1_2.String(): return NewChangeCreatedEvent() - case ChangeMergedEventV1.String(): + case ChangeMergedEventV0_1_2.String(): return NewChangeMergedEvent() - case ChangeReviewedEventV1.String(): + case ChangeReviewedEventV0_1_2.String(): return NewChangeReviewedEvent() - case ChangeUpdatedEventV1.String(): + case ChangeUpdatedEventV0_1_2.String(): return NewChangeUpdatedEvent() - case EnvironmentCreatedEventV1.String(): + case EnvironmentCreatedEventV0_1_1.String(): return NewEnvironmentCreatedEvent() - case EnvironmentDeletedEventV1.String(): + case EnvironmentDeletedEventV0_1_1.String(): return NewEnvironmentDeletedEvent() - case EnvironmentModifiedEventV1.String(): + case EnvironmentModifiedEventV0_1_1.String(): return NewEnvironmentModifiedEvent() - case IncidentDetectedEventV1.String(): + case IncidentDetectedEventV0_1_0.String(): return NewIncidentDetectedEvent() - case IncidentReportedEventV1.String(): + case IncidentReportedEventV0_1_0.String(): return NewIncidentReportedEvent() - case IncidentResolvedEventV1.String(): + case IncidentResolvedEventV0_1_0.String(): return NewIncidentResolvedEvent() - case PipelineRunFinishedEventV1.String(): + case PipelineRunFinishedEventV0_1_1.String(): return NewPipelineRunFinishedEvent() - case PipelineRunQueuedEventV1.String(): + case PipelineRunQueuedEventV0_1_1.String(): return NewPipelineRunQueuedEvent() - case PipelineRunStartedEventV1.String(): + case PipelineRunStartedEventV0_1_1.String(): return NewPipelineRunStartedEvent() - case RepositoryCreatedEventV1.String(): + case RepositoryCreatedEventV0_1_1.String(): return NewRepositoryCreatedEvent() - case RepositoryDeletedEventV1.String(): + case RepositoryDeletedEventV0_1_1.String(): return NewRepositoryDeletedEvent() - case RepositoryModifiedEventV1.String(): + case RepositoryModifiedEventV0_1_1.String(): return NewRepositoryModifiedEvent() - case ServiceDeployedEventV1.String(): + case ServiceDeployedEventV0_1_1.String(): return NewServiceDeployedEvent() - case ServicePublishedEventV1.String(): + case ServicePublishedEventV0_1_1.String(): return NewServicePublishedEvent() - case ServiceRemovedEventV1.String(): + case ServiceRemovedEventV0_1_1.String(): return NewServiceRemovedEvent() - case ServiceRolledbackEventV1.String(): + case ServiceRolledbackEventV0_1_1.String(): return NewServiceRolledbackEvent() - case ServiceUpgradedEventV1.String(): + case ServiceUpgradedEventV0_1_1.String(): return NewServiceUpgradedEvent() - case TaskRunFinishedEventV1.String(): + case TaskRunFinishedEventV0_1_1.String(): return NewTaskRunFinishedEvent() - case TaskRunStartedEventV1.String(): + case TaskRunStartedEventV0_1_1.String(): return NewTaskRunStartedEvent() - case TestCaseRunFinishedEventV1.String(): + case TestCaseRunFinishedEventV0_1_0.String(): return NewTestCaseRunFinishedEvent() - case TestCaseRunQueuedEventV1.String(): + case TestCaseRunQueuedEventV0_1_0.String(): return NewTestCaseRunQueuedEvent() - case TestCaseRunStartedEventV1.String(): + case TestCaseRunStartedEventV0_1_0.String(): return NewTestCaseRunStartedEvent() - case TestOutputPublishedEventV1.String(): + case TestOutputPublishedEventV0_1_0.String(): return NewTestOutputPublishedEvent() - case TestSuiteRunFinishedEventV1.String(): + case TestSuiteRunFinishedEventV0_1_0.String(): return NewTestSuiteRunFinishedEvent() - case TestSuiteRunQueuedEventV1.String(): + case TestSuiteRunQueuedEventV0_1_0.String(): return NewTestSuiteRunQueuedEvent() - case TestSuiteRunStartedEventV1.String(): + case TestSuiteRunStartedEventV0_1_0.String(): return NewTestSuiteRunStartedEvent() default: return nil, fmt.Errorf("event %v not supported", eventType) diff --git a/pkg/api/zz_ztest_foosubjectbarpredicate.go b/pkg/api/zz_ztest_foosubjectbarpredicate_1_2_3.go similarity index 97% rename from pkg/api/zz_ztest_foosubjectbarpredicate.go rename to pkg/api/zz_ztest_foosubjectbarpredicate_1_2_3.go index 88d64f9..1ed67a4 100644 --- a/pkg/api/zz_ztest_foosubjectbarpredicate.go +++ b/pkg/api/zz_ztest_foosubjectbarpredicate_1_2_3.go @@ -29,7 +29,7 @@ var foosubjectbarpredicateschema = `{"$schema":"https://json-schema.org/draft/20 var ( // FooSubjectBarPredicate event v1.2.3 - FooSubjectBarPredicateEventV1 CDEventType = CDEventType{ + FooSubjectBarPredicateEventV1_2_3 CDEventType = CDEventType{ Subject: "foosubject", Predicate: "barpredicate", Version: "1.2.3", @@ -52,7 +52,7 @@ type FooSubjectBarPredicateSubject struct { } func (sc FooSubjectBarPredicateSubject) GetEventType() CDEventType { - return FooSubjectBarPredicateEventV1 + return FooSubjectBarPredicateEventV1_2_3 } func (sc FooSubjectBarPredicateSubject) GetSubjectType() SubjectType { @@ -68,7 +68,7 @@ type FooSubjectBarPredicateEvent struct { // CDEventsReader implementation func (e FooSubjectBarPredicateEvent) GetType() CDEventType { - return FooSubjectBarPredicateEventV1 + return FooSubjectBarPredicateEventV1_2_3 } func (e FooSubjectBarPredicateEvent) GetVersion() string { @@ -178,7 +178,7 @@ func (e *FooSubjectBarPredicateEvent) SetSubjectReferenceField(referenceField *R func NewFooSubjectBarPredicateEvent() (*FooSubjectBarPredicateEvent, error) { e := &FooSubjectBarPredicateEvent{ Context: Context{ - Type: FooSubjectBarPredicateEventV1.String(), + Type: FooSubjectBarPredicateEventV1_2_3.String(), Version: CDEventsSpecVersion, }, Subject: FooSubjectBarPredicateSubject{ diff --git a/tools/generator.go b/tools/generator.go index 3564670..131a9db 100644 --- a/tools/generator.go +++ b/tools/generator.go @@ -97,6 +97,7 @@ type Data struct { Predicate string PredicateLower string Version string + VersionName string SubjectType string Contents []ContentField ContentTypes []ContentType @@ -109,7 +110,7 @@ type AllData struct { } func (d Data) OutputFile() string { - return "zz_" + d.Prefix + d.SubjectLower + d.PredicateLower + ".go" + return "zz_" + d.Prefix + d.SubjectLower + d.PredicateLower + "_" + d.VersionName + ".go" } func init() { @@ -175,7 +176,7 @@ func generate(templatesFolder, schemaFolder, genFolder, prefix string, goTypes m } // Process the types template - outputFileName := genFolder + string(os.PathSeparator) + "zz_" + prefix + strings.TrimSuffix(typesTemplateFileName, filepath.Ext(typesTemplateFileName)) + outputFileName := filepath.Join(genFolder, "zz_"+prefix+strings.TrimSuffix(typesTemplateFileName, filepath.Ext(typesTemplateFileName))) err = executeTemplate(allTemplates, typesTemplateFileName, outputFileName, allData.Slice) if err != nil { return err @@ -184,7 +185,7 @@ func generate(templatesFolder, schemaFolder, genFolder, prefix string, goTypes m // Process example test files - only for real data if prefix == "" { for _, examplesTestsTemplateFileName := range examplesTestsTemplateFileNames { - outputFileName := genFolder + string(os.PathSeparator) + "zz_" + prefix + strings.TrimSuffix(examplesTestsTemplateFileName, filepath.Ext(examplesTestsTemplateFileName)) + outputFileName := filepath.Join(genFolder, "zz_"+prefix+strings.TrimSuffix(examplesTestsTemplateFileName, filepath.Ext(examplesTestsTemplateFileName))) err = executeTemplate(allTemplates, examplesTestsTemplateFileName, outputFileName, allData.Slice) if err != nil { return err @@ -197,6 +198,7 @@ func generate(templatesFolder, schemaFolder, genFolder, prefix string, goTypes m func executeTemplate(allTemplates *template.Template, templateName, outputFileName string, data interface{}) error { // Write the template output to a buffer generated := new(bytes.Buffer) + err := allTemplates.ExecuteTemplate(generated, templateName, data) if err != nil { return err @@ -255,7 +257,7 @@ func getWalkProcessor(allTemplates *template.Template, genFolder string, goTypes allData.Slice = append(allData.Slice, *data) // Execute the template - return executeTemplate(allTemplates, eventTemplateFileName, genFolder+string(os.PathSeparator)+data.OutputFile(), data) + return executeTemplate(allTemplates, eventTemplateFileName, filepath.Join(genFolder, data.OutputFile()), data) } } @@ -358,6 +360,7 @@ func DataFromSchema(schema *jsonschema.Schema, mappings map[string]string) (*Dat SubjectLower: eventType.Subject, PredicateLower: eventType.Predicate, Version: eventType.Version, + VersionName: strings.ReplaceAll(eventType.Version, ".", "_"), SubjectType: subjectTypeString, Contents: contentFields, ContentTypes: contentTypes, diff --git a/tools/generator_test.go b/tools/generator_test.go index 9ff7078..02f571c 100644 --- a/tools/generator_test.go +++ b/tools/generator_test.go @@ -35,6 +35,7 @@ var ( testSubjectType = "fooSubject" testPredicate = "BarPredicate" testVersion = "1.2.3" + testVersionName = "1_2_3" ) func panicOnError(err error) { @@ -57,6 +58,7 @@ func TestDataFromSchema(t *testing.T) { SubjectLower: strings.ToLower(testSubject), PredicateLower: strings.ToLower(testPredicate), Version: testVersion, + VersionName: testVersionName, SubjectType: testSubjectType, Contents: []ContentField{{ Name: "ArtifactId", diff --git a/tools/templates/event.go.tmpl b/tools/templates/event.go.tmpl index 15a3948..9a29d28 100644 --- a/tools/templates/event.go.tmpl +++ b/tools/templates/event.go.tmpl @@ -29,7 +29,7 @@ var {{.SubjectLower}}{{.PredicateLower}}schema = `{{ .Schema }}` var ( // {{.Subject}}{{.Predicate}} event v{{.Version}} - {{.Subject}}{{.Predicate}}EventV1 CDEventType = CDEventType{ + {{.Subject}}{{.Predicate}}EventV{{.VersionName}} CDEventType = CDEventType{ Subject: "{{.SubjectLower}}", Predicate: "{{.PredicateLower}}", Version: "{{.Version}}", @@ -60,7 +60,7 @@ type {{.Subject}}{{.Predicate}}Event struct { // CDEventsReader implementation func (e {{.Subject}}{{.Predicate}}Event) GetType() CDEventType { - return {{.Subject}}{{.Predicate}}EventV1 + return {{.Subject}}{{.Predicate}}EventV{{.VersionName}} } func (e {{.Subject}}{{.Predicate}}Event) GetVersion() string { @@ -159,7 +159,7 @@ func (e *{{$.Subject}}{{$.Predicate}}Event) SetSubject{{ .Name }}({{ .NameLower func New{{.Subject}}{{.Predicate}}Event() (*{{.Subject}}{{.Predicate}}Event, error) { e := &{{.Subject}}{{.Predicate}}Event{ Context: Context{ - Type: {{.Subject}}{{.Predicate}}EventV1.String(), + Type: {{.Subject}}{{.Predicate}}EventV{{.VersionName}}.String(), Version: CDEventsSpecVersion, }, Subject: {{.Subject}}{{.Predicate}}Subject{ diff --git a/tools/templates/factory_test.go.tmpl b/tools/templates/factory_test.go.tmpl index fa669bc..6d50050 100644 --- a/tools/templates/factory_test.go.tmpl +++ b/tools/templates/factory_test.go.tmpl @@ -26,10 +26,10 @@ func init() { {{- range $i, $data := . }} tests = append(tests, testNewCDEventType{ name: "{{ .SubjectLower }} {{ .PredicateLower }}", - eventType: {{ .Subject }}{{ .Predicate }}EventV1. String(), + eventType: {{ .Subject }}{{ .Predicate }}EventV{{.VersionName}}. String(), expectedEvent: &{{ .Subject }}{{ .Predicate }}Event{ Context: Context{ - Type: {{ .Subject }}{{ .Predicate }}EventV1.String(), + Type: {{ .Subject }}{{ .Predicate }}EventV{{.VersionName}}.String(), Timestamp: timeNow(), Id: testUUID(), Version: CDEventsSpecVersion, diff --git a/tools/templates/types.go.tmpl b/tools/templates/types.go.tmpl index 9b3b11f..8550175 100644 --- a/tools/templates/types.go.tmpl +++ b/tools/templates/types.go.tmpl @@ -41,7 +41,7 @@ func init() { func NewCDEvent(eventType string) (CDEvent, error) { switch eventType { {{- range $i, $data := . }} - case {{ .Subject }}{{ .Predicate }}EventV1.String(): + case {{ .Subject }}{{ .Predicate }}EventV{{.VersionName}}.String(): return New{{ .Subject }}{{ .Predicate }}Event() {{- end }} default: diff --git a/tools/templates_test/event.go.tmpl b/tools/templates_test/event.go.tmpl index 188ad1b..50fcd1b 100644 --- a/tools/templates_test/event.go.tmpl +++ b/tools/templates_test/event.go.tmpl @@ -29,7 +29,7 @@ var {{.SubjectLower}}{{.PredicateLower}}schema = `{{ .Schema }}` var ( // {{.Subject}}{{.Predicate}} event v{{.Version}} - {{.Subject}}{{.Predicate}}EventV1 CDEventType = CDEventType{ + {{.Subject}}{{.Predicate}}EventV{{.VersionName}} CDEventType = CDEventType{ Subject: "{{.SubjectLower}}", Predicate: "{{.PredicateLower}}", Version: "{{.Version}}", @@ -48,7 +48,7 @@ type {{.Subject}}{{.Predicate}}Subject struct { } func (sc {{.Subject}}{{.Predicate}}Subject) GetEventType() CDEventType { - return {{.Subject}}{{.Predicate}}EventV1 + return {{.Subject}}{{.Predicate}}EventV{{.VersionName}} } func (sc {{.Subject}}{{.Predicate}}Subject) GetSubjectType() SubjectType { @@ -64,7 +64,7 @@ type {{.Subject}}{{.Predicate}}Event struct { // CDEventsReader implementation func (e {{.Subject}}{{.Predicate}}Event) GetType() CDEventType { - return {{.Subject}}{{.Predicate}}EventV1 + return {{.Subject}}{{.Predicate}}EventV{{.VersionName}} } func (e {{.Subject}}{{.Predicate}}Event) GetVersion() string { @@ -163,7 +163,7 @@ func (e *{{$.Subject}}{{$.Predicate}}Event) SetSubject{{ .Name }}({{ .NameLower func New{{.Subject}}{{.Predicate}}Event() (*{{.Subject}}{{.Predicate}}Event, error) { e := &{{.Subject}}{{.Predicate}}Event{ Context: Context{ - Type: {{.Subject}}{{.Predicate}}EventV1.String(), + Type: {{.Subject}}{{.Predicate}}EventV{{.VersionName}}.String(), Version: CDEventsSpecVersion, }, Subject: {{.Subject}}{{.Predicate}}Subject{