Skip to content

Commit

Permalink
move openapi.yaml to root.
Browse files Browse the repository at this point in the history
replace flipt:sdk:ignore with api_visibility restriction.

Signed-off-by: Roman Dmytrenko <[email protected]>
  • Loading branch information
erka committed Aug 7, 2024
1 parent 5f620bc commit d4da563
Show file tree
Hide file tree
Showing 12 changed files with 515 additions and 511 deletions.
2 changes: 1 addition & 1 deletion buf.gen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ plugins:
- grpc_api_configuration=rpc/flipt/flipt.yaml
strategy: all
- plugin: buf.build/community/google-gnostic-openapi
out: sdk
out: .
opt:
- version=1.47.0
- fq_schema_naming=false
Expand Down
9 changes: 5 additions & 4 deletions internal/cmd/protoc-gen-go-flipt-sdk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ import (
"slices"
"strings"

"google.golang.org/genproto/googleapis/api/visibility"
"google.golang.org/protobuf/compiler/protogen"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/pluginpb"
)

const (
importPath = "go.flipt.io/flipt/sdk/go"
emptyImport = "google.golang.org/protobuf/types/known/emptypb"

ignoreDecl = "flipt:sdk:ignore"
internalService = "internal"
)

func main() {
Expand Down Expand Up @@ -415,9 +417,8 @@ func New(t Transport, opts ...Option) SDK {
}`

func shouldIgnoreService(srv *protogen.Service) bool {
if srv.Comments.Leading != "" {
leading := strings.TrimPrefix(string(srv.Comments.Leading), "//")
return strings.TrimSpace(leading) == ignoreDecl
if v := proto.GetExtension(srv.Desc.Options(), visibility.E_ApiVisibility).(*visibility.VisibilityRule); v != nil {
return v.Restriction == internalService
}
return false
}
1 change: 0 additions & 1 deletion sdk/openapi.yaml → openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2145,4 +2145,3 @@ tags:
- name: EvaluationService
- name: Flipt
- name: OFREPService
description: flipt:sdk:ignore
60 changes: 32 additions & 28 deletions rpc/flipt/analytics/analytics.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion rpc/flipt/analytics/analytics.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ syntax = "proto3";

package flipt.analytics;

import "google/api/visibility.proto";

option go_package = "go.flipt.io/flipt/rpc/flipt/analytics";

message GetFlagEvaluationsCountRequest {
Expand All @@ -16,7 +18,7 @@ message GetFlagEvaluationsCountResponse {
repeated float values = 2;
}

// flipt:sdk:ignore
service AnalyticsService {
option (google.api.api_visibility) = {restriction: "internal"};
rpc GetFlagEvaluationsCount(GetFlagEvaluationsCountRequest) returns (GetFlagEvaluationsCountResponse) {}
}
4 changes: 0 additions & 4 deletions rpc/flipt/analytics/analytics_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d4da563

Please sign in to comment.