Skip to content

Commit 3418ccd

Browse files
committed
feat: Print a warning message when an invalid custom field is specified.
1 parent 9d8a0af commit 3418ccd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

pkg/jira/create.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ package jira
33
import (
44
"context"
55
"encoding/json"
6+
"fmt"
67
"net/http"
8+
"os"
79
"strconv"
810
"strings"
911

@@ -196,11 +198,13 @@ func constructCustomFields(fields map[string]string, data *createRequest) {
196198
data.Fields.M.customFields = make(customField)
197199

198200
for key, val := range fields {
201+
found := false
199202
for _, configured := range configuredFields {
200203
identifier := strings.ReplaceAll(strings.ToLower(strings.TrimSpace(configured.Name)), " ", "-")
201204
if identifier != strings.ToLower(key) {
202205
continue
203206
}
207+
found = true
204208

205209
switch configured.Schema.DataType {
206210
case customFieldFormatOption:
@@ -229,6 +233,10 @@ func constructCustomFields(fields map[string]string, data *createRequest) {
229233
default:
230234
data.Fields.M.customFields[configured.Key] = val
231235
}
236+
237+
if !found {
238+
fmt.Fprintf(os.Stderr, "\nInvalid custom field specified: %s\n", key)
239+
}
232240
}
233241
}
234242
}

0 commit comments

Comments
 (0)