Skip to content

Commit

Permalink
Add definitions for BFF native lang endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSGK committed Sep 25, 2024
1 parent 606b971 commit d41d2e2
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions proto/lekko/bff/v1beta1/bff.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand All @@ -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) {}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit d41d2e2

Please sign in to comment.