Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add definitions for BFF native lang endpoints #461

Merged
merged 1 commit into from
Sep 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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