-
Notifications
You must be signed in to change notification settings - Fork 0
/
users.proto
79 lines (69 loc) · 1.7 KB
/
users.proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
syntax = "proto3";
package users.v1;
import "google/api/annotations.proto";
import "protoc-gen-openapiv2/options/annotations.proto";
// These annotations are used when generating OpenAPI documentation.
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_swagger) = {
info: {
title: "Users API"
version: "1.0.0"
}
external_docs: {
url: "https://github.com/zcking/clean-api-lite";
description: "clean-api-lite repository";
}
schemes: HTTPS;
};
service UserService {
rpc CreateUser(CreateUserRequest) returns (CreateUserResponse) {
option (google.api.http) = {
post: "/api/v1/users"
body: "*"
response_body: "user"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: ["Users"]
summary: "Create a new user"
description: "Create a new user"
responses: {
key: "201"
value: {
description: "User created"
schema: {
json_schema: {
ref: ".auth.v1.User"
}
}
}
}
};
}
rpc ListUsers(ListUsersRequest) returns (ListUsersResponse) {
option (google.api.http) = {
get: "/api/v1/users"
response_body: "users"
};
option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
tags: ["Users"]
summary: "List all users"
description: "List all users"
operation_id: "listUsers"
};
}
}
message CreateUserRequest {
string name = 1;
string email = 2;
}
message CreateUserResponse {
User user = 1;
}
message ListUsersRequest {}
message ListUsersResponse {
repeated User users = 1;
}
message User {
int64 id = 1;
string name = 2;
string email = 3;
}