From 805b52cf8d16a910dfd80ab338cf365edac63ef4 Mon Sep 17 00:00:00 2001 From: Vasiliy Tolstov Date: Sat, 8 May 2021 12:46:02 +0300 Subject: [PATCH] add tags example Signed-off-by: Vasiliy Tolstov --- README.md | 2 +- example/example.proto | 44 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 example/example.proto diff --git a/README.md b/README.md index e177307..6fac19f 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ $> protoc --micro_out=debug=true,components="micro|http":. input.proto | Option | Default Value | Accepted Values | Description |-----------------------|---------------|---------------------------|----------------------- | `debug`               | *false*       | `true` or `false` | if *true*, `protoc` will generate a more verbose output -| `components` | `micro` | `micro rpc http chi gorilla` | some values cant coexists like gorilla/chi or rpc/http, values must be concatinated with pipe symbol +| `components` | `micro` | `micro rpc http chi gorilla client server` | some values can't coexists like gorilla/chi or rpc/http, values must be concatinated with pipe symbol ## Install diff --git a/example/example.proto b/example/example.proto new file mode 100644 index 0000000..01963e9 --- /dev/null +++ b/example/example.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package example; + +option go_package = "github.com/unistack-org/protoc-gen-micro/v3/example;examplepb"; + +import "tag/tag.proto"; +import "api/annotations.proto"; +import "openapiv2/annotations.proto"; +import "google/protobuf/wrappers.proto"; + +service Example { + rpc Call(CallReq) returns (CallRsp) { + option (micro.openapiv2.openapiv2_operation) = { + operation_id: "Call"; + responses: { + key: "default"; + value: { + description: "Error response"; + schema: { + json_schema: { + ref: ".example.Error"; + } + } + } + } + }; + option (micro.api.http) = { post: "/v1/example/call/{name}"; body: "*"; }; + option (micro.api.micro_method) = { timeout: 5; }; + }; +}; + +message CallReq { + string name = 1 [(micro.tag.tags) = "xml:\",attr\"" ]; + string req = 2; +}; + +message CallRsp { + string rsp = 2; +}; + +message Error { + string msg = 1; +};