From 3f74f38d7249ba020afaa3e5615c72edcffad96f Mon Sep 17 00:00:00 2001 From: marle3003 Date: Wed, 13 May 2026 12:24:19 +0200 Subject: [PATCH 1/3] fix(search): fix displaying HTTP search results --- runtime/runtime_http_search.go | 1 + runtime/runtime_http_search_test.go | 7 ++++--- webui/src/components/dashboard/search/Http.vue | 5 ++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/runtime/runtime_http_search.go b/runtime/runtime_http_search.go index f035e674c..eecd0effc 100644 --- a/runtime/runtime_http_search.go +++ b/runtime/runtime_http_search.go @@ -235,6 +235,7 @@ func getHttpSearchResult(fields map[string]string, discriminator []string) (sear "type": strings.ToLower(result.Type), "service": result.Domain, "path": fields["path"], + "methods": fields["meta.methods"], } case "operation": result.Domain = fields["api"] diff --git a/runtime/runtime_http_search_test.go b/runtime/runtime_http_search_test.go index 4a945aec7..aae5dde53 100644 --- a/runtime/runtime_http_search_test.go +++ b/runtime/runtime_http_search_test.go @@ -155,7 +155,7 @@ func TestIndex_Http(t *testing.T) { test: func(t *testing.T, app *runtime.App) { cfg := openapitest.NewConfig("3.0", openapitest.WithInfo("foo", "1.0", ""), - openapitest.WithPath("/pets"), + openapitest.WithPath("/pets", openapitest.WithOperation(http.MethodGet)), ) app.Http.Add(toConfig(cfg)) @@ -164,9 +164,9 @@ func TestIndex_Http(t *testing.T) { waitSearchIndex(t, func() bool { r, err = app.Search(search.Request{QueryText: "pets", Limit: 10}) require.NoError(t, err) - return len(r.Results) == 1 + return len(r.Results) == 2 }) - require.Len(t, r.Results, 1) + require.Len(t, r.Results, 2) require.Equal(t, search.ResultItem{ Type: "HTTP", @@ -177,6 +177,7 @@ func TestIndex_Http(t *testing.T) { "type": "http", "service": "foo", "path": "/pets", + "methods": "GET", }, }, r.Results[0]) diff --git a/webui/src/components/dashboard/search/Http.vue b/webui/src/components/dashboard/search/Http.vue index fe416b06d..aff4dc83f 100644 --- a/webui/src/components/dashboard/search/Http.vue +++ b/webui/src/components/dashboard/search/Http.vue @@ -24,6 +24,9 @@ const type = computed(() => { return 'api' }) const methods = computed(() => { + if (!props.item.params.methods) { + return [] + } return props.item.params.methods.split(',') }) @@ -46,7 +49,7 @@ const methods = computed(() => {
{{ item.domain }} · - {{ m }} + {{ m }} · From bfacfce3dc59a1d3bc4dd3e6327bfae03c88c8d3 Mon Sep 17 00:00:00 2001 From: marle3003 Date: Wed, 13 May 2026 12:35:10 +0200 Subject: [PATCH 2/3] fix(test): fix search test --- runtime/runtime_http_search_test.go | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/runtime/runtime_http_search_test.go b/runtime/runtime_http_search_test.go index aae5dde53..679ad45ac 100644 --- a/runtime/runtime_http_search_test.go +++ b/runtime/runtime_http_search_test.go @@ -167,7 +167,8 @@ func TestIndex_Http(t *testing.T) { return len(r.Results) == 2 }) require.Len(t, r.Results, 2) - require.Equal(t, + require.Contains(t, + r.Results, search.ResultItem{ Type: "HTTP", Domain: "foo", @@ -180,7 +181,22 @@ func TestIndex_Http(t *testing.T) { "methods": "GET", }, }, - r.Results[0]) + ) + require.Contains(t, + r.Results, + search.ResultItem{ + Type: "HTTP", + Domain: "foo", + Title: "/pets", + Fragments: []string{"/pets"}, + Params: map[string]string{ + "type": "http", + "service": "foo", + "path": "/pets", + "method": "GET", + }, + }, + ) }, }, { From dd054360812f6d411910d5902d1395b9b86988bb Mon Sep 17 00:00:00 2001 From: maesi Date: Wed, 13 May 2026 13:43:33 +0200 Subject: [PATCH 3/3] fix(test): fix search test --- runtime/runtime_http_search_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/runtime/runtime_http_search_test.go b/runtime/runtime_http_search_test.go index 679ad45ac..2675548da 100644 --- a/runtime/runtime_http_search_test.go +++ b/runtime/runtime_http_search_test.go @@ -237,6 +237,7 @@ func TestIndex_Http(t *testing.T) { "type": "http", "service": "foo", "path": "/pets", + "methods": "", }, }, r.Results[0])