Skip to content

Commit

Permalink
update protocol buffers, generate using buf, added quotes, claims and…
Browse files Browse the repository at this point in the history
… new endpoint on enrich
  • Loading branch information
andefined committed Mar 21, 2022
1 parent 2ad80d1 commit c674b6d
Show file tree
Hide file tree
Showing 16 changed files with 559 additions and 93 deletions.
23 changes: 18 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
protocols:
protoc -I/usr/local/include -I. -I${GOPATH}/src --go_out=:. --go-grpc_out=:. plagiarism/grpc_plagiarism.proto
protoc -I/usr/local/include -I. -I${GOPATH}/src --go_out=:. --go-grpc_out=:. scrape/grpc_scrape.proto
protoc -I/usr/local/include -I. -I${GOPATH}/src --go_out=:. --go-grpc_out=:. compare/grpc_compare.proto
protoc -I/usr/local/include -I. -I${GOPATH}/src --go_out=:. --go-grpc_out=:. enrich/grpc_enrich.proto
BUF_VERSION=1.1.0

help: ## Print Help
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)

buf-install: ## Install buf
curl -sSL \
"https://github.com/bufbuild/buf/releases/download/v${BUF_VERSION}/buf-$(shell uname -s)-$(shell uname -m)" \
-o "$(shell go env GOPATH)/bin/buf" && \
chmod +x "$(shell go env GOPATH)/bin/buf"

proto-build: ## Generate protocol buffers
buf generate

proto: proto-build ## Build protocol buffers

.DEFAULT_GOAL := help
.PHONY: help buf-install proto proto-build
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
# svc-proto
plagiari.sm Proto Buffers. Make sure you use protoc 3.14.0.
MediaWatch protocol buffers.

## Build the proto files
```bash
$ make build
# install buf (v1.1.0)
make buf-install
# build proto
make proto
```
14 changes: 14 additions & 0 deletions buf.gen.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: v1
managed:
enabled: true
go_package_prefix:
default: github.com/plagiari-sm/svc-proto
plugins:
- name: go
out: .
opt: paths=source_relative
- name: go-grpc
out: .
opt:
- paths=source_relative
- require_unimplemented_servers=false
2 changes: 2 additions & 0 deletions buf.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Generated by buf. DO NOT EDIT.
version: v1
16 changes: 16 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
version: v1
lint:
use:
- BASIC
rpc_allow_same_request_response: true
except:
- PACKAGE_VERSION_SUFFIX
- SERVICE_SUFFIX
- PACKAGE_DIRECTORY_MATCH
- RPC_REQUEST_RESPONSE_UNIQUE
- RPC_REQUEST_STANDARD_NAME
- RPC_RESPONSE_STANDARD_NAME
- FIELD_LOWER_SNAKE_CASE
breaking:
use:
- FILE
22 changes: 12 additions & 10 deletions compare/grpc_compare.pb.go

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

6 changes: 2 additions & 4 deletions compare/grpc_compare_grpc.pb.go

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

104 changes: 80 additions & 24 deletions enrich/grpc_enrich.pb.go

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

11 changes: 10 additions & 1 deletion enrich/grpc_enrich.proto
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ package enrich;
option go_package = "enrich;enrich";

service Enrich {
rpc NLP(Request) returns (Response) {};
rpc NLP (Request) returns (Response) {};
rpc StopWords (Request) returns (Response) {};
rpc Keywords (Request) returns (Response) {};
rpc Entities (Request) returns (Response) {};
rpc Summary (Request) returns (Response) {};
rpc Topics (Request) returns (Response) {};
rpc Quotes (Request) returns (Response) {};
rpc Claims (Request) returns (Response) {};
}

message Request {
Expand All @@ -24,6 +31,8 @@ message NLP {
repeated Entity entities = 3;
string summary = 4;
repeated string topics = 5;
repeated string claims = 6;
repeated string quotes = 7;
}

message Data {
Expand Down
Loading

0 comments on commit c674b6d

Please sign in to comment.