Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

👻 questionnaires: require presence of order field #499

Merged
merged 1 commit into from
Sep 29, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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