@@ -48,7 +48,7 @@ func (r *Loader) staticRender(ctx context.Context, db database.Store) (*staticRe
48
48
},
49
49
// Always use the default, since we used to assume the empty string
50
50
Value : previewtypes .StringLiteral (it .DefaultValue ),
51
- Diagnostics : nil ,
51
+ Diagnostics : make (previewtypes. Diagnostics , 0 ) ,
52
52
}
53
53
54
54
if it .ValidationError != "" || it .ValidationRegex != "" || it .ValidationMonotonic != "" {
@@ -82,7 +82,15 @@ func (r *Loader) staticRender(ctx context.Context, db database.Store) (*staticRe
82
82
}
83
83
84
84
var protoOptions []* sdkproto.RichParameterOption
85
- _ = json .Unmarshal (it .Options , & protoOptions ) // Not going to make this fatal
85
+ err := json .Unmarshal (it .Options , & protoOptions )
86
+ if err != nil {
87
+ param .Diagnostics = append (param .Diagnostics , & hcl.Diagnostic {
88
+ Severity : hcl .DiagError ,
89
+ Summary : "Failed to parse json parameter options" ,
90
+ Detail : err .Error (),
91
+ })
92
+ }
93
+
86
94
for _ , opt := range protoOptions {
87
95
param .Options = append (param .Options , & previewtypes.ParameterOption {
88
96
Name : opt .Name ,
@@ -97,7 +105,7 @@ func (r *Loader) staticRender(ctx context.Context, db database.Store) (*staticRe
97
105
// for a given set of conditions.
98
106
_ , param .FormType , _ = provider .ValidateFormType (provider .OptionType (param .Type ), len (param .Options ), param .FormType )
99
107
100
- param .Diagnostics = previewtypes .Diagnostics (param .Valid (param .Value ))
108
+ param .Diagnostics = append ( param . Diagnostics , previewtypes .Diagnostics (param .Valid (param .Value )) ... )
101
109
params = append (params , param )
102
110
}
103
111
0 commit comments