Skip to content

Commit c10c1c8

Browse files
committed
Send JQ evaluator rules
1 parent a1d1138 commit c10c1c8

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

cmd/kosli/attestGeneric.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ func newAttestGenericCmd(out io.Writer) *cobra.Command {
126126
return ValidateRegistryFlags(cmd, o.fingerprintOptions)
127127

128128
},
129+
129130
RunE: func(cmd *cobra.Command, args []string) error {
130131
return o.run(args)
131132
},

cmd/kosli/createAttestationType.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ type JQEvaluatorPayload struct {
2626
Rules []string `json:"rules"`
2727
}
2828

29-
func NewJQEvaluatorPayload(rules []string) JQEvaluatorPayload {
30-
return JQEvaluatorPayload{"jq", rules}
29+
func NewJQEvaluatorPayload(rules []string) *JQEvaluatorPayload {
30+
return &JQEvaluatorPayload{"jq", rules}
3131
}
3232

3333
type CreateAttestationTypePayload struct {
34-
TypeName string `json:"name"`
35-
Description string `json:"description"`
36-
Evaluator JQEvaluatorPayload `json:"evaluator"`
34+
TypeName string `json:"name"`
35+
Description string `json:"description,omitempty"`
36+
Evaluator *JQEvaluatorPayload `json:"evaluator,omitempty"`
3737
}
3838

3939
func newCreateAttestationTypeCmd(out io.Writer) *cobra.Command {
@@ -66,7 +66,9 @@ func newCreateAttestationTypeCmd(out io.Writer) *cobra.Command {
6666

6767
func (o *createAttestationTypeOptions) run(args []string) error {
6868
o.payload.TypeName = args[0]
69-
o.payload.Evaluator = NewJQEvaluatorPayload(o.jqRules)
69+
if len(o.jqRules) > 0 {
70+
o.payload.Evaluator = NewJQEvaluatorPayload(o.jqRules)
71+
}
7072

7173
form, err := prepareAttestationTypeForm(o.payload, o.schemaFilePath)
7274
if err != nil {

0 commit comments

Comments
 (0)