Skip to content

Commit

Permalink
👻 questionnaires: require presence of order field (#499)
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Lucidi <[email protected]>
  • Loading branch information
mansam authored Sep 29, 2023
1 parent ce5fdf2 commit 546f14b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions assessment/section.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
Expand Down

0 comments on commit 546f14b

Please sign in to comment.