Skip to content

Commit 6720865

Browse files
committed
remove compatible models from brick instance list endpoint
1 parent 3d8b8ea commit 6720865

File tree

4 files changed

+55
-5
lines changed

4 files changed

+55
-5
lines changed

internal/api/docs/openapi.yaml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1192,7 +1192,7 @@ components:
11921192
properties:
11931193
bricks:
11941194
items:
1195-
$ref: '#/components/schemas/BrickInstance'
1195+
$ref: '#/components/schemas/BrickInstanceListItem'
11961196
nullable: true
11971197
type: array
11981198
type: object
@@ -1374,6 +1374,31 @@ components:
13741374
for backward compatibility.'
13751375
type: object
13761376
type: object
1377+
BrickInstanceListItem:
1378+
properties:
1379+
author:
1380+
type: string
1381+
category:
1382+
type: string
1383+
config_variables:
1384+
items:
1385+
$ref: '#/components/schemas/BrickConfigVariable'
1386+
type: array
1387+
id:
1388+
type: string
1389+
model:
1390+
type: string
1391+
name:
1392+
type: string
1393+
status:
1394+
type: string
1395+
variables:
1396+
additionalProperties:
1397+
type: string
1398+
description: 'Deprecated: use config_variables instead. This field is kept
1399+
for backward compatibility.'
1400+
type: object
1401+
type: object
13771402
BrickListItem:
13781403
properties:
13791404
author:

internal/e2e/client/client.gen.go

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/orchestrator/bricks/bricks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ func (s *Service) List() (BrickListResult, error) {
7070
}
7171

7272
func (s *Service) AppBrickInstancesList(a *app.ArduinoApp) (AppBrickInstancesResult, error) {
73-
res := AppBrickInstancesResult{BrickInstances: make([]BrickInstance, len(a.Descriptor.Bricks))}
73+
res := AppBrickInstancesResult{BrickInstances: make([]BrickInstanceListItem, len(a.Descriptor.Bricks))}
7474
for i, brickInstance := range a.Descriptor.Bricks {
7575
brick, found := s.bricksIndex.FindBrickByID(brickInstance.ID)
7676
if !found {
@@ -79,7 +79,7 @@ func (s *Service) AppBrickInstancesList(a *app.ArduinoApp) (AppBrickInstancesRes
7979

8080
variablesMap, configVariables := getBrickConfigDetails(brick, brickInstance.Variables)
8181

82-
res.BrickInstances[i] = BrickInstance{
82+
res.BrickInstances[i] = BrickInstanceListItem{
8383
ID: brick.ID,
8484
Name: brick.Name,
8585
Author: "Arduino", // TODO: for now we only support our bricks

internal/orchestrator/bricks/types.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,18 @@ type BrickListItem struct {
2929
}
3030

3131
type AppBrickInstancesResult struct {
32-
BrickInstances []BrickInstance `json:"bricks"`
32+
BrickInstances []BrickInstanceListItem `json:"bricks"`
33+
}
34+
35+
type BrickInstanceListItem struct {
36+
ID string `json:"id"`
37+
Name string `json:"name"`
38+
Author string `json:"author"`
39+
Category string `json:"category"`
40+
Status string `json:"status"`
41+
Variables map[string]string `json:"variables,omitempty" description:"Deprecated: use config_variables instead. This field is kept for backward compatibility."`
42+
ConfigVariables []BrickConfigVariable `json:"config_variables,omitempty"`
43+
ModelID string `json:"model,omitempty"`
3344
}
3445

3546
type BrickInstance struct {

0 commit comments

Comments
 (0)