-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add grpc proto spec files in 'io' package
- Loading branch information
1 parent
6c8849d
commit 92fa0ca
Showing
3 changed files
with
166 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "com.store.order.proto"; | ||
option go_package = "github.com/znsio/specmatic-order-bff-grpc-go/com/store/order/proto"; | ||
option java_outer_classname = "OrderProto"; | ||
|
||
package com.store; | ||
import "buf/validate/validate.proto"; | ||
|
||
service OrderService { | ||
rpc SearchOrders(OrderSearchRequest) returns (OrderListResponse); | ||
rpc GetOrder(OrderId) returns (Order); | ||
rpc AddOrder(NewOrder) returns (OrderId); | ||
rpc UpdateOrder(Order) returns (OrderResponse); | ||
rpc DeleteOrder(OrderId) returns (OrderResponse); | ||
} | ||
|
||
enum OrderStatus { | ||
NULL_ORD_STATUS = 0; | ||
FULFILLED = 1; | ||
PENDING = 2; | ||
CANCELLED = 3; | ||
} | ||
|
||
message Order { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
int32 productId = 2 [(buf.validate.field).required = true]; | ||
int32 count = 3 [(buf.validate.field).required = true]; | ||
OrderStatus status = 4 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message NewOrder { | ||
int32 productId = 1 [(buf.validate.field).required = true]; | ||
int32 count = 2 [(buf.validate.field).required = true]; | ||
OrderStatus status = 3 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message OrderId { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message OrderSearchRequest { | ||
int32 productId = 1; | ||
OrderStatus status = 2 [(buf.validate.field).enum.defined_only = true]; | ||
} | ||
|
||
message OrderListResponse { | ||
repeated Order orders = 1; | ||
} | ||
|
||
message OrderResponse { | ||
string message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "com.store.product.proto"; | ||
option go_package = "github.com/znsio/specmatic-order-bff-grpc-go/com/store/product/proto"; | ||
option java_outer_classname = "ProductProto"; | ||
|
||
package com.store; | ||
import "buf/validate/validate.proto"; | ||
|
||
service ProductService { | ||
rpc SearchProducts(ProductSearchRequest) returns (ProductListResponse); | ||
rpc GetProduct(ProductId) returns (Product); | ||
rpc AddProduct(NewProduct) returns (ProductId); | ||
rpc UpdateProduct(Product) returns (ProductResponse); | ||
rpc DeleteProduct(ProductId) returns (ProductResponse); | ||
} | ||
|
||
enum ProductType { | ||
NULL_PROD_TYPE = 0; | ||
BOOK = 1; | ||
FOOD = 2; | ||
GADGET = 3; | ||
OTHER = 4; | ||
} | ||
|
||
message Product { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
string name = 2 [(buf.validate.field).required = true]; | ||
ProductType type = 3 [(buf.validate.field).required = true]; | ||
int32 inventory = 4 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message NewProduct { | ||
string name = 1 [(buf.validate.field).required = true]; | ||
ProductType type = 2 [(buf.validate.field).required = true]; | ||
int32 inventory = 3 [(buf.validate.field).required = false]; | ||
} | ||
|
||
message ProductId { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message ProductSearchRequest { | ||
ProductType type = 1 [(buf.validate.field).enum.defined_only = true]; | ||
} | ||
|
||
message ProductListResponse { | ||
repeated Product products = 1; | ||
} | ||
|
||
message ProductResponse { | ||
string message = 1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
syntax = "proto3"; | ||
|
||
option java_multiple_files = true; | ||
option java_package = "com.store.order.bff.proto"; | ||
option go_package = "github.com/znsio/specmatic-order-bff-grpc-go/com/store/order/bff/proto"; | ||
option java_outer_classname = "BffProto"; | ||
|
||
package com.store.order.bff; | ||
import "buf/validate/validate.proto"; | ||
|
||
service OrderService { | ||
rpc findAvailableProducts(findAvailableProductsRequest) returns (ProductListResponse); | ||
rpc createOrder(NewOrder) returns (OrderId); | ||
rpc createProduct(NewProduct) returns (ProductId); | ||
} | ||
|
||
enum ProductType { | ||
NULL_PROD_TYPE = 0; | ||
BOOK = 1; | ||
FOOD = 2; | ||
GADGET = 3; | ||
OTHER = 4; | ||
} | ||
|
||
message findAvailableProductsRequest { | ||
ProductType type = 1 [(buf.validate.field).enum.defined_only = true]; | ||
int32 pageSize = 2 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message Product { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
string name = 2 [(buf.validate.field).required = true]; | ||
ProductType type = 3 [(buf.validate.field).required = true]; | ||
int32 inventory = 4 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message ProductListResponse { | ||
repeated Product products = 1; | ||
} | ||
|
||
message NewOrder { | ||
int32 productId = 1 [(buf.validate.field).required = true]; | ||
int32 count = 2 [(buf.validate.field).required = true, (buf.validate.field).int32.gte = 2, (buf.validate.field).int32.lte = 100]; | ||
} | ||
|
||
message OrderId { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
} | ||
|
||
message NewProduct { | ||
string name = 1 [(buf.validate.field).required = true, (buf.validate.field).string.min_len = 5, (buf.validate.field).string.max_len = 10]; | ||
ProductType type = 2 [(buf.validate.field).required = true]; | ||
int32 inventory = 3 [(buf.validate.field).required = false]; | ||
} | ||
|
||
message ProductId { | ||
int32 id = 1 [(buf.validate.field).required = true]; | ||
} |