From 7fef625c8994797cf018186ffa5a17c66088454e Mon Sep 17 00:00:00 2001 From: Samuel Lucidi Date: Tue, 24 Oct 2023 09:42:20 -0400 Subject: [PATCH] :bug: Explicitly set yaml names for camelCased fields (#535) Fixes #527 Signed-off-by: Sam Lucidi --- api/adoptionplan.go | 10 +++++----- api/analysis.go | 2 +- api/assessment.go | 4 ++-- api/base.go | 8 ++++---- api/group.go | 2 +- api/import.go | 10 +++++----- api/migrationwave.go | 6 +++--- api/review.go | 8 ++++---- api/ruleset.go | 2 +- api/stakeholder.go | 8 ++++---- api/target.go | 6 +++--- api/ticket.go | 2 +- api/tracker.go | 2 +- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/api/adoptionplan.go b/api/adoptionplan.go index da32c3278..b7c1f5c44 100644 --- a/api/adoptionplan.go +++ b/api/adoptionplan.go @@ -113,13 +113,13 @@ func (h AdoptionPlanHandler) Graph(ctx *gin.Context) { // // Vertex represents a vertex in the dependency graph. type Vertex struct { - ID uint `json:"applicationId"` - Name string `json:"applicationName"` + ID uint `json:"applicationId" yaml:"applicationId"` + Name string `json:"applicationName" yaml:"applicationName"` Decision string `json:"decision"` - EffortEstimate string `json:"effortEstimate"` + EffortEstimate string `json:"effortEstimate" yaml:"effortEstimate"` Effort int `json:"effort"` - PositionY int `json:"positionY"` - PositionX int `json:"positionX"` + PositionY int `json:"positionY" yaml:"positionY"` + PositionX int `json:"positionX" yaml:"positionX"` } // diff --git a/api/analysis.go b/api/analysis.go index 35d977ec6..e0bc461b7 100644 --- a/api/analysis.go +++ b/api/analysis.go @@ -1977,7 +1977,7 @@ type Incident struct { File string `json:"file"` Line int `json:"line"` Message string `json:"message"` - CodeSnip string `json:"codeSnip"` + CodeSnip string `json:"codeSnip" yaml:"codeSnip"` Facts FactMap `json:"facts"` } diff --git a/api/assessment.go b/api/assessment.go index a8bc5d4c5..edc4fa843 100644 --- a/api/assessment.go +++ b/api/assessment.go @@ -156,13 +156,13 @@ type Assessment struct { Questionnaire Ref `json:"questionnaire" binding:"required"` Sections []assessment.Section `json:"sections"` Stakeholders []Ref `json:"stakeholders"` - StakeholderGroups []Ref `json:"stakeholderGroups"` + StakeholderGroups []Ref `json:"stakeholderGroups" yaml:"stakeholderGroups"` // read only Risk string `json:"risk"` Confidence int `json:"confidence"` Status string `json:"status"` Thresholds assessment.Thresholds `json:"thresholds"` - RiskMessages assessment.RiskMessages `json:"riskMessages"` + RiskMessages assessment.RiskMessages `json:"riskMessages" yaml:"riskMessages"` } // diff --git a/api/base.go b/api/base.go index 5e0c9607e..df303b945 100644 --- a/api/base.go +++ b/api/base.go @@ -299,10 +299,10 @@ func (h *BaseHandler) Attachment(ctx *gin.Context, name string) { // // REST resource. type Resource struct { - ID uint `json:"id,omitempty" yaml:",omitempty"` - CreateUser string `json:"createUser" yaml:",omitempty"` - UpdateUser string `json:"updateUser" yaml:",omitempty"` - CreateTime time.Time `json:"createTime" yaml:",omitempty"` + ID uint `json:"id,omitempty" yaml:"id,omitempty"` + CreateUser string `json:"createUser" yaml:"createUser,omitempty"` + UpdateUser string `json:"updateUser" yaml:"updateUser,omitempty"` + CreateTime time.Time `json:"createTime" yaml:"createTime,omitempty"` } // diff --git a/api/group.go b/api/group.go index 41871c744..4d88b067a 100644 --- a/api/group.go +++ b/api/group.go @@ -183,7 +183,7 @@ type StakeholderGroup struct { Name string `json:"name" binding:"required"` Description string `json:"description"` Stakeholders []Ref `json:"stakeholders"` - MigrationWaves []Ref `json:"migrationWaves"` + MigrationWaves []Ref `json:"migrationWaves" yaml:"migrationWaves"` } // diff --git a/api/import.go b/api/import.go index f4d969738..17a03b39c 100644 --- a/api/import.go +++ b/api/import.go @@ -421,11 +421,11 @@ type Import map[string]interface{} type ImportSummary struct { Resource Filename string `json:"filename"` - ImportStatus string `json:"importStatus"` - ImportTime time.Time `json:"importTime"` - ValidCount int `json:"validCount"` - InvalidCount int `json:"invalidCount"` - CreateEntities bool `json:"createEntities"` + ImportStatus string `json:"importStatus" yaml:"importStatus"` + ImportTime time.Time `json:"importTime" yaml:"importTime"` + ValidCount int `json:"validCount" yaml:"validCount"` + InvalidCount int `json:"invalidCount" yaml:"invalidCount"` + CreateEntities bool `json:"createEntities" yaml:"createEntities"` } // diff --git a/api/migrationwave.go b/api/migrationwave.go index 557fa766f..16ea85fca 100644 --- a/api/migrationwave.go +++ b/api/migrationwave.go @@ -185,11 +185,11 @@ func (h MigrationWaveHandler) Delete(ctx *gin.Context) { type MigrationWave struct { Resource Name string `json:"name"` - StartDate time.Time `json:"startDate"` - EndDate time.Time `json:"endDate"` + StartDate time.Time `json:"startDate" yaml:"startDate"` + EndDate time.Time `json:"endDate" yaml:"endDate"` Applications []Ref `json:"applications"` Stakeholders []Ref `json:"stakeholders"` - StakeholderGroups []Ref `json:"stakeholderGroups"` + StakeholderGroups []Ref `json:"stakeholderGroups" yaml:"stakeholderGroups"` } // diff --git a/api/review.go b/api/review.go index d94e307f4..102cdbdb3 100644 --- a/api/review.go +++ b/api/review.go @@ -225,10 +225,10 @@ func (h ReviewHandler) CopyReview(ctx *gin.Context) { // Review REST resource. type Review struct { Resource - BusinessCriticality uint `json:"businessCriticality"` - EffortEstimate string `json:"effortEstimate"` - ProposedAction string `json:"proposedAction"` - WorkPriority uint `json:"workPriority"` + BusinessCriticality uint `json:"businessCriticality" yaml:"businessCriticality"` + EffortEstimate string `json:"effortEstimate" yaml:"effortEstimate"` + ProposedAction string `json:"proposedAction" yaml:"proposedAction"` + WorkPriority uint `json:"workPriority" yaml:"workPriority"` Comments string `json:"comments"` Application *Ref `json:"application,omitempty" binding:"required_without=Archetype,excluded_with=Archetype"` Archetype *Ref `json:"archetype,omitempty" binding:"required_without=Application,excluded_with=Application"` diff --git a/api/ruleset.go b/api/ruleset.go index 90d5bb2bf..fd1d99915 100644 --- a/api/ruleset.go +++ b/api/ruleset.go @@ -308,7 +308,7 @@ type RuleSet struct { Rules []Rule `json:"rules"` Repository *Repository `json:"repository,omitempty"` Identity *Ref `json:"identity,omitempty"` - DependsOn []Ref `json:"dependsOn"` + DependsOn []Ref `json:"dependsOn" yaml:"dependsOn"` } // diff --git a/api/stakeholder.go b/api/stakeholder.go index 21f8d63f8..f9f5afdcd 100644 --- a/api/stakeholder.go +++ b/api/stakeholder.go @@ -193,12 +193,12 @@ type Stakeholder struct { Resource Name string `json:"name" binding:"required"` Email string `json:"email" binding:"required"` - Groups []Ref `json:"stakeholderGroups"` - BusinessServices []Ref `json:"businessServices"` - JobFunction *Ref `json:"jobFunction"` + Groups []Ref `json:"stakeholderGroups" yaml:"stakeholderGroups"` + BusinessServices []Ref `json:"businessServices" yaml:"businessServices"` + JobFunction *Ref `json:"jobFunction" yaml:"jobFunction"` Owns []Ref `json:"owns"` Contributes []Ref `json:"contributes"` - MigrationWaves []Ref `json:"migrationWaves"` + MigrationWaves []Ref `json:"migrationWaves" yaml:"migrationWaves"` } // diff --git a/api/target.go b/api/target.go index 512009f2d..2e4d9e6b0 100644 --- a/api/target.go +++ b/api/target.go @@ -241,11 +241,11 @@ type Target struct { Resource Name string `json:"name"` Description string `json:"description"` - Choice bool `json:"choice,omitempty"` - Custom bool `json:"custom,omitempty"` + Choice bool `json:"choice,omitempty" yaml:",omitempty"` + Custom bool `json:"custom,omitempty" yaml:",omitempty"` Labels []Label `json:"labels"` Image Ref `json:"image"` - RuleSet *RuleSet `json:"ruleset,omitempty"` + RuleSet *RuleSet `json:"ruleset,omitempty" yaml:"ruleset,omitempty"` } type Label struct { diff --git a/api/ticket.go b/api/ticket.go index 75ff7c369..0a9e4d0cc 100644 --- a/api/ticket.go +++ b/api/ticket.go @@ -154,7 +154,7 @@ type Ticket struct { Error bool `json:"error"` Message string `json:"message"` Status string `json:"status"` - LastUpdated time.Time `json:"lastUpdated"` + LastUpdated time.Time `json:"lastUpdated" yaml:"lastUpdated"` Fields Fields `json:"fields"` Application Ref `json:"application" binding:"required"` Tracker Ref `json:"tracker" binding:"required"` diff --git a/api/tracker.go b/api/tracker.go index 085074baf..4f130de0a 100644 --- a/api/tracker.go +++ b/api/tracker.go @@ -317,7 +317,7 @@ type Tracker struct { Kind string `json:"kind" binding:"required,oneof=jira-cloud jira-onprem"` Message string `json:"message"` Connected bool `json:"connected"` - LastUpdated time.Time `json:"lastUpdated"` + LastUpdated time.Time `json:"lastUpdated" yaml:"lastUpdated"` Identity Ref `json:"identity" binding:"required"` Insecure bool `json:"insecure"` }