Skip to content

Commit

Permalink
feat: added multiline validation
Browse files Browse the repository at this point in the history
  • Loading branch information
MarvinJWendt committed Feb 9, 2024
1 parent abd82f3 commit 48866d6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
7 changes: 7 additions & 0 deletions pkg/model/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ func (v Variable) Validate() []error {
}
}

// Multiline is only applicable to text types
if v.Multiline {
if v.Type != "text" {
errors = append(errors, newValidationError(v, "multiline is only applicable to text types"))
}
}

// Options are only applicable to select and multiselect types
if len(v.Options) > 0 {
if v.Type != "select" && v.Type != "multiselect" {
Expand Down
6 changes: 6 additions & 0 deletions testdata/must-fail/number/multiline-number.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# yaml-language-server: $schema=https://gttp.dev/schema
variables:
- name: Number
type: number
multiline: true
template: "{{ .Number }}"

0 comments on commit 48866d6

Please sign in to comment.