Skip to content

Commit 0fecf63

Browse files
committed
rename variable name
1 parent 7456335 commit 0fecf63

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

internal/orchestrator/bricks/bricks.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -129,9 +129,9 @@ func (s *Service) AppBrickInstanceDetails(a *app.ArduinoApp, brickID string) (Br
129129

130130
func getBrickConfigDetails(
131131
brick *bricksindex.Brick, userVariables map[string]string,
132-
) (map[string]string, []BrickInstanceVariable) {
132+
) (map[string]string, []BrickConfigVariable) {
133133
variablesMap := make(map[string]string, len(brick.Variables))
134-
variableDetails := make([]BrickInstanceVariable, 0, len(brick.Variables))
134+
variableDetails := make([]BrickConfigVariable, 0, len(brick.Variables))
135135

136136
for _, v := range brick.Variables {
137137
finalValue := v.DefaultValue
@@ -142,7 +142,7 @@ func getBrickConfigDetails(
142142
}
143143
variablesMap[v.Name] = finalValue
144144

145-
variableDetails = append(variableDetails, BrickInstanceVariable{
145+
variableDetails = append(variableDetails, BrickConfigVariable{
146146
Name: v.Name,
147147
Value: finalValue,
148148
Description: v.Description,

internal/orchestrator/bricks/bricks_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
116116
name string
117117
brick *bricksindex.Brick
118118
userVariables map[string]string
119-
expectedInstanceVariable []BrickInstanceVariable
119+
expectedInstanceVariable []BrickConfigVariable
120120
expectedVariableMap map[string]string
121121
}{
122122
{
@@ -127,7 +127,7 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
127127
},
128128
},
129129
userVariables: map[string]string{"VAR1": "value1"},
130-
expectedInstanceVariable: []BrickInstanceVariable{
130+
expectedInstanceVariable: []BrickConfigVariable{
131131
{Name: "VAR1", Value: "value1", Description: "desc", Required: true},
132132
},
133133
expectedVariableMap: map[string]string{"VAR1": "value1"},
@@ -140,7 +140,7 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
140140
},
141141
},
142142
userVariables: map[string]string{},
143-
expectedInstanceVariable: []BrickInstanceVariable{
143+
expectedInstanceVariable: []BrickConfigVariable{
144144
{Name: "VAR1", Value: "", Description: "desc", Required: true},
145145
},
146146
expectedVariableMap: map[string]string{"VAR1": ""},
@@ -153,7 +153,7 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
153153
},
154154
},
155155
userVariables: map[string]string{},
156-
expectedInstanceVariable: []BrickInstanceVariable{
156+
expectedInstanceVariable: []BrickConfigVariable{
157157
{Name: "VAR1", Value: "default", Description: "desc", Required: false},
158158
},
159159
expectedVariableMap: map[string]string{"VAR1": "default"},
@@ -167,7 +167,7 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
167167
},
168168
},
169169
userVariables: map[string]string{"VAR1": "v1"},
170-
expectedInstanceVariable: []BrickInstanceVariable{
170+
expectedInstanceVariable: []BrickConfigVariable{
171171
{Name: "VAR1", Value: "v1", Description: "desc1", Required: true},
172172
{Name: "VAR2", Value: "def2", Description: "desc2", Required: false},
173173
},
@@ -177,7 +177,7 @@ func TestGetBrickInstanceVariableDetails(t *testing.T) {
177177
name: "no variables",
178178
brick: &bricksindex.Brick{Variables: []bricksindex.BrickVariable{}},
179179
userVariables: map[string]string{},
180-
expectedInstanceVariable: []BrickInstanceVariable{},
180+
expectedInstanceVariable: []BrickConfigVariable{},
181181
expectedVariableMap: map[string]string{},
182182
},
183183
}

internal/orchestrator/bricks/types.go

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@ type AppBrickInstancesResult struct {
3434
}
3535

3636
type BrickInstance struct {
37-
ID string `json:"id"`
38-
Name string `json:"name"`
39-
Author string `json:"author"`
40-
Category string `json:"category"`
41-
Status string `json:"status"`
42-
Variables map[string]string `json:"variables,omitempty" description:"Deprecated: use config_variables instead. This field is kept for backward compatibility."`
43-
ConfigVariables []BrickInstanceVariable `json:"config_variables,omitempty"`
44-
ModelID string `json:"model,omitempty"`
37+
ID string `json:"id"`
38+
Name string `json:"name"`
39+
Author string `json:"author"`
40+
Category string `json:"category"`
41+
Status string `json:"status"`
42+
Variables map[string]string `json:"variables,omitempty" description:"Deprecated: use config_variables instead. This field is kept for backward compatibility."`
43+
ConfigVariables []BrickConfigVariable `json:"config_variables,omitempty"`
44+
ModelID string `json:"model,omitempty"`
4545
}
4646

47-
type BrickInstanceVariable struct {
47+
type BrickConfigVariable struct {
4848
Name string `json:"name"`
4949
Value string `json:"value"`
5050
Description string `json:"description"`

0 commit comments

Comments
 (0)