From 51597e7b70b4309a1d83155c4819e8b5991dd6e7 Mon Sep 17 00:00:00 2001 From: Sam Lucidi Date: Fri, 29 Sep 2023 13:36:03 -0400 Subject: [PATCH] questionnaires: require presence of `order` field Signed-off-by: Sam Lucidi --- assessment/section.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/assessment/section.go b/assessment/section.go index 18bd22c5e..b865406df 100644 --- a/assessment/section.go +++ b/assessment/section.go @@ -3,7 +3,7 @@ package assessment // // Section represents a group of questions in a questionnaire. type Section struct { - Order uint `json:"order" yaml:"order"` + Order uint `json:"order" yaml:"order" binding:"required"` Name string `json:"name" yaml:"name"` Questions []Question `json:"questions" yaml:"questions"` } @@ -53,7 +53,7 @@ func (r *Section) Tags() (tags []CategorizedTag) { // // Question represents a question in a questionnaire. type Question struct { - Order uint `json:"order" yaml:"order"` + Order uint `json:"order" yaml:"order" binding:"required"` Text string `json:"text" yaml:"text"` Explanation string `json:"explanation" yaml:"explanation"` IncludeFor []CategorizedTag `json:"includeFor,omitempty" yaml:"includeFor,omitempty" binding:"excluded_with=ExcludeFor"` @@ -98,7 +98,7 @@ func (r *Question) Tags() (tags []CategorizedTag) { // // Answer represents an answer to a question in a questionnaire. type Answer struct { - Order uint `json:"order" yaml:"order"` + Order uint `json:"order" yaml:"order" binding:"required"` Text string `json:"text" yaml:"text"` Risk string `json:"risk" yaml:"risk" binding:"oneof=red,yellow,green,unknown"` Rationale string `json:"rationale" yaml:"rationale"`