From d41d2e2f670fe279e2c95fe31c099a3ac78cc21a Mon Sep 17 00:00:00 2001 From: David Kang Date: Wed, 25 Sep 2024 14:51:03 -0700 Subject: [PATCH] Add definitions for BFF native lang endpoints --- proto/lekko/bff/v1beta1/bff.proto | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/proto/lekko/bff/v1beta1/bff.proto b/proto/lekko/bff/v1beta1/bff.proto index b2971c99..d8cf25c2 100644 --- a/proto/lekko/bff/v1beta1/bff.proto +++ b/proto/lekko/bff/v1beta1/bff.proto @@ -74,6 +74,8 @@ service BFFService { rpc GetFeature(GetFeatureRequest) returns (GetFeatureResponse) {} rpc GetFeatureHistory(GetFeatureHistoryRequest) returns (GetFeatureHistoryResponse) {} rpc GetRepositoryContents(GetRepositoryContentsRequest) returns (GetRepositoryContentsResponse) {} + // Gets native lang code for a specific namespace. + rpc GetNativeLang(GetNativeLangRequest) returns (GetNativeLangResponse) {} rpc AddNamespace(AddNamespaceRequest) returns (AddNamespaceResponse) {} rpc RemoveNamespace(RemoveNamespaceRequest) returns (RemoveNamespaceResponse) {} rpc AddFeature(AddFeatureRequest) returns (AddFeatureResponse) {} @@ -84,6 +86,8 @@ service BFFService { rpc Save(SaveRequest) returns (SaveResponse) {} // Saves the raw starlark of a feature to the local repo, and runs compilation. rpc SaveStarlark(SaveStarlarkRequest) returns (SaveStarlarkResponse) {} + // Saves changes to a namespace using native lang code and runs compilation. + rpc SaveNativeLang(SaveNativeLangRequest) returns (SaveNativeLangResponse) {} // Helper for Rules AST -> String. rpc ConvertRuleToString(ConvertRuleToStringRequest) returns (ConvertRuleToStringResponse) {} @@ -450,6 +454,17 @@ message GetRepositoryContentsResponse { google.protobuf.FileDescriptorSet file_descriptor_set = 4; } +message GetNativeLangRequest { + BranchKey key = 1; + string namespace_name = 2; + string language = 3; +} + +message GetNativeLangResponse { + Branch branch = 1; + string code = 2; +} + message GetFeatureRequest { // includes the branch name to fetch from. If 'main', // we will fetch from mysql. If not, we will fetch @@ -795,6 +810,21 @@ message SaveStarlarkResponse { bool success = 5; } +message SaveNativeLangRequest { + BranchKey key = 1; + string namespace_name = 2; + string language = 3; + string code = 4; +} + +message SaveNativeLangResponse { + Branch branch = 1; + string formatted = 2; + // TODO: We probably want some kind of linting/checking endpoint that surfaces diagnostic errors + // if parsing native lang code fails, so that the editor can show in-code errors or suggest fixes. + // This could be part of SaveNativeLang with a dry_run-esque option or a separate endpoint. +} + message ConvertRuleToStringRequest { lekko.rules.v1beta3.Rule rule = 1; }