Skip to content

Commit ddd4918

Browse files
committed
fix: 去除rest client生成
1 parent 3cb53fe commit ddd4918

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+22381
-13
lines changed

cmd/protoc-gen-lava/gen-lava/lava.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ func generateFileContent(gen *protogen.Plugin, file *protogen.File, g *protogen.
6969
for _, service := range file.Services {
7070
genClient(gen, file, g, service)
7171
genRpcInfo(gen, file, g, service)
72-
genRestApiTest(gen, file, g, service)
72+
//genRestApiTest(gen, file, g, service)
7373
//genRestRouter(gen, file, g, service)
7474
genGinRouter(gen, file, g, service)
7575
genSql(gen, file, g, service)
Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
### gid.ABitOfEverythingService.Create
2+
// Create a new ABitOfEverything
3+
//
4+
// This API creates a new ABitOfEverything
5+
POST http://localhost:8080/v1/example/a_bit_of_everything/{float_value}/{double_value}/{int64_value}/separator/{uint64_value}/{int32_value}/{fixed64_value}/{fixed32_value}/{bool_value}/{string_value=strprefix/*}/{uint32_value}/{sfixed32_value}/{sfixed64_value}/{sint32_value}/{sint64_value}/{nonConventionalNameValue}/{enum_value}
6+
Content-Type: application/json
7+
8+
### gid.ABitOfEverythingService.CreateBody
9+
POST http://localhost:8080/v1/example/a_bit_of_everything
10+
Content-Type: application/json
11+
12+
### gid.ABitOfEverythingService.CreateBook
13+
// Create a book.
14+
POST http://localhost:8080/v1/{parent=publishers/*}/books
15+
Content-Type: application/json
16+
17+
### gid.ABitOfEverythingService.UpdateBook
18+
PATCH http://localhost:8080/v1/{book.name=publishers/*/books/*}
19+
Content-Type: application/json
20+
21+
### gid.ABitOfEverythingService.Update
22+
PUT http://localhost:8080/v1/example/a_bit_of_everything/{uuid}
23+
Content-Type: application/json
24+
25+
### gid.ABitOfEverythingService.UpdateV2
26+
PUT http://localhost:8080/v2/example/a_bit_of_everything/{abe.uuid}
27+
Content-Type: application/json
28+
29+
### gid.ABitOfEverythingService.GetQuery
30+
// rpc Delete(grpc.gateway.examples.internal.proto.sub2.IdMessage) returns (google.protobuf.Empty) {
31+
// option (google.api.http) = {
32+
// delete: "/v1/example/a_bit_of_everything/{uuid}"
33+
// };
34+
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
35+
// security: {
36+
// security_requirement: {
37+
// key: "ApiKeyAuth";
38+
// value: {}
39+
// }
40+
// security_requirement: {
41+
// key: "OAuth2";
42+
// value: {
43+
// scope: "read";
44+
// scope: "write";
45+
// }
46+
// }
47+
// }
48+
// extensions: {
49+
// key: "x-irreversible";
50+
// value {
51+
// bool_value: true;
52+
// }
53+
// }
54+
// };
55+
// }
56+
GET http://localhost:8080/v1/example/a_bit_of_everything/query/{uuid}
57+
Content-Type: application/json
58+
59+
### gid.ABitOfEverythingService.GetRepeatedQuery
60+
GET http://localhost:8080/v1/example/a_bit_of_everything_repeated/{path_repeated_float_value}/{path_repeated_double_value}/{path_repeated_int64_value}/{path_repeated_uint64_value}/{path_repeated_int32_value}/{path_repeated_fixed64_value}/{path_repeated_fixed32_value}/{path_repeated_bool_value}/{path_repeated_string_value}/{path_repeated_bytes_value}/{path_repeated_uint32_value}/{path_repeated_enum_value}/{path_repeated_sfixed32_value}/{path_repeated_sfixed64_value}/{path_repeated_sint32_value}/{path_repeated_sint64_value}
61+
Content-Type: application/json
62+
63+
### gid.ABitOfEverythingService.DeepPathEcho
64+
// Echo allows posting a StringMessage value.
65+
//
66+
// It also exposes multiple bindings.
67+
//
68+
// This makes it useful when validating that the OpenAPI v2 API
69+
// description exposes documentation correctly on all paths
70+
// defined as additional_bindings in the proto.
71+
// rpc Echo(grpc.gateway.examples.internal.proto.sub.StringMessage) returns (grpc.gateway.examples.internal.proto.sub.StringMessage) {
72+
// option (google.api.http) = {
73+
// get: "/v1/example/a_bit_of_everything/echo/{value}"
74+
// additional_bindings {
75+
// post: "/v2/example/echo"
76+
// body: "value"
77+
// }
78+
// additional_bindings {
79+
// get: "/v2/example/echo"
80+
// }
81+
// };
82+
// option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
83+
// description: "Description Echo";
84+
// summary: "Summary: Echo rpc";
85+
// tags: "echo rpc";
86+
// external_docs: {
87+
// url: "https://github.com/grpc-ecosystem/grpc-gateway";
88+
// description: "Find out more Echo";
89+
// }
90+
// responses: {
91+
// key: "200"
92+
// value: {
93+
// examples: {
94+
// key: "application/json"
95+
// value: '{"value": "the input value"}'
96+
// }
97+
// }
98+
// }
99+
// responses: {
100+
// key: "503";
101+
// value: {
102+
// description: "Returned when the resource is temporarily unavailable.";
103+
// extensions: {
104+
// key: "x-number";
105+
// value {
106+
// number_value: 100;
107+
// }
108+
// }
109+
// }
110+
// }
111+
// responses: {
112+
// // Overwrites global definition.
113+
// key: "404";
114+
// value: {
115+
// description: "Returned when the resource does not exist.";
116+
// schema: {
117+
// json_schema: {
118+
// type: INTEGER;
119+
// }
120+
// }
121+
// }
122+
// }
123+
// };
124+
// }
125+
POST http://localhost:8080/v1/example/deep_path/{single_nested.name}
126+
Content-Type: application/json
127+
128+
### gid.ABitOfEverythingService.NoBindings
129+
GET http://localhost:8080/v2/example/NoBindings
130+
Content-Type: application/json
131+
132+
### gid.ABitOfEverythingService.Timeout
133+
GET http://localhost:8080/v2/example/timeout
134+
Content-Type: application/json
135+
136+
### gid.ABitOfEverythingService.ErrorWithDetails
137+
GET http://localhost:8080/v2/example/errorwithdetails
138+
Content-Type: application/json
139+
140+
### gid.ABitOfEverythingService.GetMessageWithBody
141+
POST http://localhost:8080/v2/example/withbody/{id}
142+
Content-Type: application/json
143+
144+
### gid.ABitOfEverythingService.PostWithEmptyBody
145+
POST http://localhost:8080/v2/example/postwithemptybody/{name}
146+
Content-Type: application/json
147+
148+
### gid.ABitOfEverythingService.CheckGetQueryParams
149+
GET http://localhost:8080/v1/example/a_bit_of_everything/params/get/{single_nested.name}
150+
Content-Type: application/json
151+
152+
### gid.ABitOfEverythingService.CheckNestedEnumGetQueryParams
153+
GET http://localhost:8080/v1/example/a_bit_of_everything/params/get/nested_enum/{single_nested.ok}
154+
Content-Type: application/json
155+
156+
### gid.ABitOfEverythingService.CheckPostQueryParams
157+
POST http://localhost:8080/v1/example/a_bit_of_everything/params/post/{string_value}
158+
Content-Type: application/json
159+
160+
### gid.ABitOfEverythingService.OverwriteResponseContentType
161+
GET http://localhost:8080/v2/example/overwriteresponsecontenttype
162+
Content-Type: application/json
163+
164+
### gid.ABitOfEverythingService.CheckStatus
165+
GET http://localhost:8080/v1/example/checkStatus
166+
Content-Type: application/json
167+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### gid.AnotherServiceWithNoBindings.NoBindings
2+
GET http://localhost:8080/v2/another/no-bindings
3+
Content-Type: application/json
4+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### gid.CamelCaseServiceName.Empty
2+
GET http://localhost:8080/v2/example/empty
3+
Content-Type: application/json
4+
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
### gid.EchoService.Echo
2+
// Echo method receives a simple message and returns it.
3+
//
4+
// The message posted as the id parameter will also be
5+
// returned.
6+
POST http://localhost:8080/v1/example/echo/{id}
7+
Content-Type: application/json
8+
9+
### gid.EchoService.EchoBody
10+
// EchoBody method receives a simple message and returns it.
11+
POST http://localhost:8080/v1/example/echo_body
12+
Content-Type: application/json
13+
14+
### gid.EchoService.EchoDelete
15+
// EchoDelete method receives a simple message and returns it.
16+
DELETE http://localhost:8080/v1/example/echo_delete
17+
Content-Type: application/json
18+
19+
### gid.EchoService.EchoPatch
20+
// EchoPatch method receives a NonStandardUpdateRequest and returns it.
21+
PATCH http://localhost:8080/v1/example/echo_patch
22+
Content-Type: application/json
23+
24+
### gid.EchoService.EchoUnauthorized
25+
// EchoUnauthorized method receives a simple message and returns it. It must
26+
// always return a google.rpc.Code of `UNAUTHENTICATED` and a HTTP Status code
27+
// of 401.
28+
GET http://localhost:8080/v1/example/echo_unauthorized
29+
Content-Type: application/json
30+

example/docs/http/gid.Id.http

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### gid.Id.Generate
2+
// Generate 生成ID
3+
POST http://localhost:8080/v1/id/generate
4+
Content-Type: application/json
5+
6+
### gid.Id.Types
7+
// Types id类型
8+
GET http://localhost:8080/v1/id/types
9+
Content-Type: application/json
10+
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
### gid.LoginService.Login
2+
// Login
3+
//
4+
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
5+
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
6+
//
7+
// ## {{.RequestType.Name}}
8+
// | Field ID | Name | Type | Description |
9+
// | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}}
10+
// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
11+
//
12+
// ## {{.ResponseType.Name}}
13+
// | Field ID | Name | Type | Description |
14+
// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
15+
// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
16+
POST http://localhost:8080/v1/example/login
17+
Content-Type: application/json
18+
19+
### gid.LoginService.Logout
20+
// Logout
21+
//
22+
// {{.MethodDescriptorProto.Name}} is a call with the method(s) {{$first := true}}{{range .Bindings}}{{if $first}}{{$first = false}}{{else}}, {{end}}{{.HTTPMethod}}{{end}} within the "{{.Service.Name}}" service.
23+
// It takes in "{{.RequestType.Name}}" and returns a "{{.ResponseType.Name}}".
24+
//
25+
// ## {{.RequestType.Name}}
26+
// | Field ID | Name | Type | Description |
27+
// | ----------- | --------- | --------------------------------------------------------- | ---------------------------- | {{range .RequestType.Fields}}
28+
// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
29+
//
30+
// ## {{.ResponseType.Name}}
31+
// | Field ID | Name | Type | Description |
32+
// | ----------- | --------- | ---------------------------------------------------------- | ---------------------------- | {{range .ResponseType.Fields}}
33+
// | {{.Number}} | {{.Name}} | {{if eq .Label.String "LABEL_REPEATED"}}[]{{end}}{{.Type}} | {{fieldcomments .Message .}} | {{end}}
34+
POST http://localhost:8080/v1/example/logout
35+
Content-Type: application/json
36+

example/docs/http/gid.User.http

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
### gid.User.Generate
2+
// Generate 生成ID
3+
POST http://localhost:8080/v1/id/generate
4+
Content-Type: application/json
5+
6+
### gid.User.Types
7+
// Types id类型
8+
GET http://localhost:8080/v1/id/types
9+
Content-Type: application/json
10+
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### hello.Greeter.SayHello
2+
GET http://localhost:8080/say/{name}
3+
Content-Type: application/json
4+
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### hello.TestApi.Version
2+
// Version rpc
3+
GET http://localhost:8080/v1/version
4+
Content-Type: application/json
5+
6+
### hello.TestApi.Version1
7+
POST http://localhost:8080/v1/version1
8+
Content-Type: application/json
9+
10+
### hello.TestApi.VersionTest
11+
// VersionTest rpc
12+
GET http://localhost:8080/v1/example/versiontest
13+
Content-Type: application/json
14+
15+
### hello.TestApi.VersionTestCustom
16+
// VersionTest rpc custom
17+
GET http://localhost:8080/v1/example/versionTestCustom
18+
Content-Type: application/json
19+

0 commit comments

Comments
 (0)