From f6c181939005307b50284cb218da4a363f38f5da Mon Sep 17 00:00:00 2001 From: Ramey GIrdhar Date: Fri, 21 Jan 2022 09:05:04 +0530 Subject: [PATCH 1/3] feat(stencil): add support for search API - add RPC call `SearchSchemas` - define messages `SearchSchemasRequest` and `SearchSchemasResponse` --- odpf/stencil/v1beta1/stencil.proto | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/odpf/stencil/v1beta1/stencil.proto b/odpf/stencil/v1beta1/stencil.proto index bbea2a75..173cbe3c 100644 --- a/odpf/stencil/v1beta1/stencil.proto +++ b/odpf/stencil/v1beta1/stencil.proto @@ -127,6 +127,16 @@ service StencilService { summary: "Delete specified version of the schema"; }; } + + rpc SearchSchemas(SearchSchemasRequest) returns (SearchSchemasResponse) { + option (google.api.http) = { + get: "/v1beta1/namespaces/{namespace_id}/schemas/_search" + }; + option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { + tags: "schema"; + summary: "Search all the schemas in a given namespace"; + }; + } } message Namespace { @@ -295,3 +305,21 @@ message DeleteVersionRequest { message DeleteVersionResponse { string message = 1; } + +message SearchSchemasRequest { + string namespace_id = 1; + int32 version_id = 2; + string query = 3; +} + +message SearchSchemasResponse { + string namepsace_id = 1; + repeated SearchHits hits = 2; +} + +message SearchHits { + string schema = 1; + int32 version_id = 2; + repeated string fields = 3; + repeated string types = 4; +} From bb19300651b550d423905a3accb8f4028f6929f2 Mon Sep 17 00:00:00 2001 From: Ramey GIrdhar Date: Fri, 28 Jan 2022 09:01:39 +0530 Subject: [PATCH 2/3] feat(stencil): add global search api * modify `SearchSchemas` API to global `Search` API * modify `SearchSchemasRequest` * modify `SearchSchemasResponse` to include search `meta` --- odpf/stencil/v1beta1/stencil.proto | 33 ++++++++++++++++++------------ 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/odpf/stencil/v1beta1/stencil.proto b/odpf/stencil/v1beta1/stencil.proto index 173cbe3c..0bdba536 100644 --- a/odpf/stencil/v1beta1/stencil.proto +++ b/odpf/stencil/v1beta1/stencil.proto @@ -128,13 +128,13 @@ service StencilService { }; } - rpc SearchSchemas(SearchSchemasRequest) returns (SearchSchemasResponse) { + rpc Search(SearchRequest) returns (SearchResponse) { option (google.api.http) = { - get: "/v1beta1/namespaces/{namespace_id}/schemas/_search" + get: "/v1beta1/search" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { tags: "schema"; - summary: "Search all the schemas in a given namespace"; + summary: "Global Search API"; }; } } @@ -306,20 +306,27 @@ message DeleteVersionResponse { string message = 1; } -message SearchSchemasRequest { +message SearchRequest { string namespace_id = 1; - int32 version_id = 2; - string query = 3; + string schema_id = 2; + int32 version_id = 3; + string query = 4; + bool all = 5; } -message SearchSchemasResponse { - string namepsace_id = 1; - repeated SearchHits hits = 2; +message SearchResponse { + repeated SearchHits hits = 1; + SearchMeta meta = 2; } message SearchHits { - string schema = 1; - int32 version_id = 2; - repeated string fields = 3; - repeated string types = 4; + string namespace_id = 1; + string schema_id = 2; + int32 version_id = 3; + repeated string fields = 4; + repeated string types = 5; +} + +message SearchMeta { + uint32 total = 1; } From c78ac246732fdabf903621105305308309e465d0 Mon Sep 17 00:00:00 2001 From: Ramey GIrdhar Date: Tue, 1 Feb 2022 17:13:44 +0530 Subject: [PATCH 3/3] feat(stencil): global search api * change `all` param in `SearchRequest` to `history` * use oneof for `version_id` and `history` code review by @ravisuhag and @harikrishnakanchi --- odpf/stencil/v1beta1/stencil.proto | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/odpf/stencil/v1beta1/stencil.proto b/odpf/stencil/v1beta1/stencil.proto index 0bdba536..5addc66f 100644 --- a/odpf/stencil/v1beta1/stencil.proto +++ b/odpf/stencil/v1beta1/stencil.proto @@ -309,9 +309,12 @@ message DeleteVersionResponse { message SearchRequest { string namespace_id = 1; string schema_id = 2; - int32 version_id = 3; - string query = 4; - bool all = 5; + string query = 3; + + oneof version { + bool history = 4; + int32 version_id = 5; + } } message SearchResponse {