Skip to content

Commit 1679c77

Browse files
committed
update field name for brick details endpoint
1 parent 6ce75f0 commit 1679c77

File tree

6 files changed

+46
-45
lines changed

6 files changed

+46
-45
lines changed

internal/api/docs/openapi.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1319,15 +1319,15 @@ components:
13191319
$ref: '#/components/schemas/CodeExample'
13201320
nullable: true
13211321
type: array
1322-
description:
1323-
type: string
1324-
id:
1325-
type: string
1326-
models:
1322+
compatible_models:
13271323
items:
13281324
$ref: '#/components/schemas/AIModel'
13291325
nullable: true
13301326
type: array
1327+
description:
1328+
type: string
1329+
id:
1330+
type: string
13311331
name:
13321332
type: string
13331333
readme:
@@ -1353,6 +1353,7 @@ components:
13531353
compatible_models:
13541354
items:
13551355
$ref: '#/components/schemas/AIModel'
1356+
nullable: true
13561357
type: array
13571358
config_variables:
13581359
items:

internal/e2e/client/client.gen.go

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

internal/e2e/daemon/brick_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func TestBricksDetails(t *testing.T) {
144144
require.NotEmpty(t, *response.JSON200.Readme)
145145
require.NotNil(t, response.JSON200.UsedByApps, "UsedByApps should not be nil")
146146
require.Equal(t, expectedUsedByApps, *(response.JSON200.UsedByApps))
147-
require.NotNil(t, response.JSON200.Models, "Models should not be nil")
148-
require.Equal(t, expectedModelLiteInfo, *(response.JSON200.Models))
147+
require.NotNil(t, response.JSON200.CompatibleModels, "Models should not be nil")
148+
require.Equal(t, expectedModelLiteInfo, *(response.JSON200.CompatibleModels))
149149
})
150150
}

internal/orchestrator/bricks/bricks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ func (s *Service) BricksDetails(id string, idProvider *app.IDProvider,
209209
ApiDocsPath: apiDocsPath,
210210
CodeExamples: codeExamples,
211211
UsedByApps: usedByApps,
212-
Models: f.Map(s.modelsIndex.GetModelsByBrick(brick.ID), func(m modelsindex.AIModel) AIModel {
212+
CompatibleModels: f.Map(s.modelsIndex.GetModelsByBrick(brick.ID), func(m modelsindex.AIModel) AIModel {
213213
return AIModel{
214214
ID: m.ID,
215215
Name: m.Name,

internal/orchestrator/bricks/bricks_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -418,13 +418,13 @@ func TestBricksDetails(t *testing.T) {
418418
require.Len(t, res.UsedByApps, 1)
419419
require.Equal(t, "My App", res.UsedByApps[0].Name)
420420
require.NotEmpty(t, res.UsedByApps[0].ID)
421-
require.Len(t, res.Models, 2)
422-
require.Equal(t, "yolox-object-detection", res.Models[0].ID)
423-
require.Equal(t, "General purpose object detection - YoloX", res.Models[0].Name)
424-
require.Equal(t, "General purpose object detection...", res.Models[0].Description)
425-
require.Equal(t, "face-detection", res.Models[1].ID)
426-
require.Equal(t, "Lightweight-Face-Detection", res.Models[1].Name)
427-
require.Equal(t, "", res.Models[1].Description)
421+
require.Len(t, res.CompatibleModels, 2)
422+
require.Equal(t, "yolox-object-detection", res.CompatibleModels[0].ID)
423+
require.Equal(t, "General purpose object detection - YoloX", res.CompatibleModels[0].Name)
424+
require.Equal(t, "General purpose object detection...", res.CompatibleModels[0].Description)
425+
require.Equal(t, "face-detection", res.CompatibleModels[1].ID)
426+
require.Equal(t, "Lightweight-Face-Detection", res.CompatibleModels[1].Name)
427+
require.Equal(t, "", res.CompatibleModels[1].Description)
428428
})
429429

430430
t.Run("Success - Full Details - no models", func(t *testing.T) {
@@ -443,7 +443,7 @@ func TestBricksDetails(t *testing.T) {
443443
require.Len(t, res.UsedByApps, 1)
444444
require.Equal(t, "My App", res.UsedByApps[0].Name)
445445
require.NotEmpty(t, res.UsedByApps[0].ID)
446-
require.Len(t, res.Models, 0)
446+
require.Len(t, res.CompatibleModels, 0)
447447
})
448448

449449
t.Run("Success - Full Details - one model", func(t *testing.T) {
@@ -452,10 +452,10 @@ func TestBricksDetails(t *testing.T) {
452452

453453
require.Equal(t, "arduino:one_model_brick", res.ID)
454454
require.Equal(t, "one model brick", res.Name)
455-
require.Len(t, res.Models, 1)
456-
require.Equal(t, "face-detection", res.Models[0].ID)
457-
require.Equal(t, "Lightweight-Face-Detection", res.Models[0].Name)
458-
require.Equal(t, "", res.Models[0].Description)
455+
require.Len(t, res.CompatibleModels, 1)
456+
require.Equal(t, "face-detection", res.CompatibleModels[0].ID)
457+
require.Equal(t, "Lightweight-Face-Detection", res.CompatibleModels[0].Name)
458+
require.Equal(t, "", res.CompatibleModels[0].Description)
459459
})
460460
}
461461

internal/orchestrator/bricks/types.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,16 @@ type AppReference struct {
7272
}
7373

7474
type BrickDetailsResult struct {
75-
ID string `json:"id"`
76-
Name string `json:"name"`
77-
Author string `json:"author"`
78-
Description string `json:"description"`
79-
Category string `json:"category"`
80-
Status string `json:"status"`
81-
Variables map[string]BrickVariable `json:"variables,omitempty"`
82-
Readme string `json:"readme"`
83-
ApiDocsPath string `json:"api_docs_path"`
84-
CodeExamples []CodeExample `json:"code_examples"`
85-
UsedByApps []AppReference `json:"used_by_apps"`
86-
Models []AIModel `json:"models"`
75+
ID string `json:"id"`
76+
Name string `json:"name"`
77+
Author string `json:"author"`
78+
Description string `json:"description"`
79+
Category string `json:"category"`
80+
Status string `json:"status"`
81+
Variables map[string]BrickVariable `json:"variables,omitempty"`
82+
Readme string `json:"readme"`
83+
ApiDocsPath string `json:"api_docs_path"`
84+
CodeExamples []CodeExample `json:"code_examples"`
85+
UsedByApps []AppReference `json:"used_by_apps"`
86+
CompatibleModels []AIModel `json:"compatible_models"`
8787
}

0 commit comments

Comments
 (0)