grpc-rest 0.1.17 → 0.1.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -30,6 +30,17 @@ type method struct {
30
30
  PathInfo []PathInfo
31
31
  Body string
32
32
  HttpMethod string
33
+ RestOptions string
34
+ }
35
+
36
+ func rubyRestOptions(restOptions map[string]bool) string {
37
+ var opts []string
38
+ for opt, val := range restOptions {
39
+ if val {
40
+ opts = append(opts, fmt.Sprintf("%v: true", opt))
41
+ }
42
+ }
43
+ return "{" + strings.Join(opts, ", ") + "}"
33
44
  }
34
45
 
35
46
  type Route struct {
@@ -71,7 +82,7 @@ class {{.ControllerName}}Controller < ActionController::Base
71
82
  parameters = request.parameters.to_h.deep_transform_keys(&:underscore)
72
83
  grpc_request = GrpcRest.init_request({{.RequestType}}, parameters.slice(*fields))
73
84
  GrpcRest.assign_params(grpc_request, METHOD_PARAM_MAP["{{.Name}}"], "{{.Body}}", request.parameters)
74
- render json: GrpcRest.send_request("{{$fullServiceName}}", "{{.Name}}", grpc_request)
85
+ render json: GrpcRest.send_request("{{$fullServiceName}}", "{{.Name}}", grpc_request, {{.RestOptions}})
75
86
  end
76
87
  {{end}}
77
88
  end
@@ -90,18 +101,21 @@ func ProcessService(service *descriptorpb.ServiceDescriptorProto, pkg string) (F
90
101
  if err != nil {
91
102
  return FileResult{}, routes, err
92
103
  }
104
+ restOpts, err := ExtractRestOptions(m)
105
+ if err != nil { return FileResult{}, routes, err }
93
106
  httpMethod, path, err := MethodAndPath(opts.Pattern)
94
107
  pathInfo, err := ParsedPath(path)
95
108
  if err != nil {
96
109
  return FileResult{}, routes, err
97
110
  }
98
111
  controllerMethod := method{
99
- Name: strcase.ToSnake(m.GetName()),
100
- RequestType: Classify(m.GetInputType()),
101
- Path: path,
102
- HttpMethod: httpMethod,
103
- Body: opts.Body,
104
- PathInfo: pathInfo,
112
+ Name: strcase.ToSnake(m.GetName()),
113
+ RequestType: Classify(m.GetInputType()),
114
+ Path: path,
115
+ RestOptions: rubyRestOptions(restOpts),
116
+ HttpMethod: httpMethod,
117
+ Body: opts.Body,
118
+ PathInfo: pathInfo,
105
119
  }
106
120
  data.Methods = append(data.Methods, controllerMethod)
107
121
  routes = append(routes, Route{
@@ -4,6 +4,7 @@ import (
4
4
  "encoding/json"
5
5
  "fmt"
6
6
  options "google.golang.org/genproto/googleapis/api/annotations"
7
+ options2 "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2/options"
7
8
  "google.golang.org/protobuf/proto"
8
9
  "google.golang.org/protobuf/types/descriptorpb"
9
10
  "regexp"
@@ -79,4 +80,22 @@ func ExtractAPIOptions(meth *descriptorpb.MethodDescriptorProto) (*options.HttpR
79
80
  return opts, nil
80
81
  }
81
82
 
83
+ func ExtractRestOptions(meth *descriptorpb.MethodDescriptorProto) (map[string]bool, error) {
84
+ if meth.Options == nil {
85
+ return nil, nil
86
+ }
87
+ if !proto.HasExtension(meth.Options, options2.E_Openapiv2Operation) {
88
+ return nil, nil
89
+ }
90
+ ext := proto.GetExtension(meth.Options, options2.E_Openapiv2Operation)
91
+ operation, ok := ext.(*options2.Operation)
92
+ if !ok {
93
+ return nil, fmt.Errorf("extension is %T; want an Operation", ext)
94
+ }
95
+ operationExt := operation.GetExtensions()
96
+ emitDefaults := operationExt["x-grpc-rest-emit-defaults"].GetBoolValue()
97
+ return map[string]bool{
98
+ "emit_defaults": emitDefaults,
99
+ }, nil
100
+ }
82
101
 
@@ -36,7 +36,7 @@ class MyServiceController < ActionController::Base
36
36
  parameters = request.parameters.to_h.deep_transform_keys(&:underscore)
37
37
  grpc_request = GrpcRest.init_request(Testdata::TestRequest, parameters.slice(*fields))
38
38
  GrpcRest.assign_params(grpc_request, METHOD_PARAM_MAP["test"], "", request.parameters)
39
- render json: GrpcRest.send_request("Testdata::MyService", "test", grpc_request)
39
+ render json: GrpcRest.send_request("Testdata::MyService", "test", grpc_request, {emit_defaults: true})
40
40
  end
41
41
 
42
42
  def test_2
@@ -44,7 +44,7 @@ class MyServiceController < ActionController::Base
44
44
  parameters = request.parameters.to_h.deep_transform_keys(&:underscore)
45
45
  grpc_request = GrpcRest.init_request(Testdata::TestRequest, parameters.slice(*fields))
46
46
  GrpcRest.assign_params(grpc_request, METHOD_PARAM_MAP["test_2"], "second_record", request.parameters)
47
- render json: GrpcRest.send_request("Testdata::MyService", "test_2", grpc_request)
47
+ render json: GrpcRest.send_request("Testdata::MyService", "test_2", grpc_request, {})
48
48
  end
49
49
 
50
50
  def test_3
@@ -52,7 +52,7 @@ class MyServiceController < ActionController::Base
52
52
  parameters = request.parameters.to_h.deep_transform_keys(&:underscore)
53
53
  grpc_request = GrpcRest.init_request(Testdata::TestRequest, parameters.slice(*fields))
54
54
  GrpcRest.assign_params(grpc_request, METHOD_PARAM_MAP["test_3"], "", request.parameters)
55
- render json: GrpcRest.send_request("Testdata::MyService", "test_3", grpc_request)
55
+ render json: GrpcRest.send_request("Testdata::MyService", "test_3", grpc_request, {})
56
56
  end
57
57
 
58
58
  def test_4
@@ -60,7 +60,7 @@ class MyServiceController < ActionController::Base
60
60
  parameters = request.parameters.to_h.deep_transform_keys(&:underscore)
61
61
  grpc_request = GrpcRest.init_request(Testdata::TestRequest, parameters.slice(*fields))
62
62
  GrpcRest.assign_params(grpc_request, METHOD_PARAM_MAP["test_4"], "*", request.parameters)
63
- render json: GrpcRest.send_request("Testdata::MyService", "test_4", grpc_request)
63
+ render json: GrpcRest.send_request("Testdata::MyService", "test_4", grpc_request, {})
64
64
  end
65
65
 
66
66
  end
@@ -5,6 +5,7 @@ package testdata;
5
5
  import "google/api/annotations.proto";
6
6
  import "google/protobuf/struct.proto";
7
7
  import "google/protobuf/timestamp.proto";
8
+ import "protoc-gen-openapiv2/options/annotations.proto";
8
9
 
9
10
  message TestRequest {
10
11
  string test_id = 1;
@@ -18,6 +19,7 @@ message TestRequest {
18
19
  google.protobuf.Value bare_value = 9;
19
20
  repeated SubRecord sub_records = 10;
20
21
  int32 some_int = 11;
22
+ TestEnum some_enum = 12;
21
23
  }
22
24
 
23
25
  message SubRecord {
@@ -28,6 +30,13 @@ message SubRecord {
28
30
  message TestResponse {
29
31
  int32 some_int = 1;
30
32
  string full_response = 2;
33
+ string ignored_key = 3;
34
+ }
35
+
36
+ enum TestEnum {
37
+ TEST_ENUM_UNSPECIFIED = 0;
38
+ TEST_ENUM_FOO = 1;
39
+ TEST_ENUM_BAR = 2;
31
40
  }
32
41
 
33
42
  service MyService {
@@ -35,6 +44,14 @@ service MyService {
35
44
  option (google.api.http) = {
36
45
  get: "/test/{foobar=blah/*}"
37
46
  };
47
+ option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = {
48
+ extensions: {
49
+ key: 'x-grpc-rest-emit-defaults';
50
+ value: {
51
+ bool_value: true;
52
+ }
53
+ }
54
+ };
38
55
  }
39
56
 
40
57
  rpc Test2(TestRequest) returns (TestResponse) {
@@ -29,7 +29,8 @@ RSpec.describe MyServiceController, type: :request do
29
29
  expect(response).to be_successful
30
30
  expect(response.parsed_body).to eq({
31
31
  'someInt' => 1,
32
- 'fullResponse' => %({"testId":"abc","foobar":"xyz"})
32
+ 'fullResponse' => %({"testId":"abc","foobar":"xyz"}),
33
+ "ignoredKey" => ''
33
34
  })
34
35
  end
35
36
  end
@@ -63,8 +64,8 @@ RSpec.describe MyServiceController, type: :request do
63
64
  end
64
65
 
65
66
  describe 'full body splat' do
66
- it 'should be successful' do
67
- params = {
67
+ let(:params) do
68
+ {
68
69
  test_id: 'abc',
69
70
  some_int: "65",
70
71
  foobar: 'xyz',
@@ -91,12 +92,26 @@ RSpec.describe MyServiceController, type: :request do
91
92
  list_value: ['F', 'Y', 'I'],
92
93
  bare_value: 45,
93
94
  timestamp_field: '2024-04-03 01:02:03 UTC',
95
+ some_enum: 'TEST_ENUM_FOO'
94
96
  }
97
+ end
98
+
99
+ it 'should be successful' do
100
+ post '/test4', params: params, as: :json
101
+ expect(response).to be_successful
102
+ expect(response.parsed_body).to eq({
103
+ 'someInt' => 4,
104
+ 'fullResponse' => %({"testId":"abc","foobar":"xyz","repeatedString":["W","T","F"],"subRecord":{"subId":"id1","anotherId":"id2"},"secondRecord":{"subId":"id3","anotherId":"id4"},"structField":{"bool_key":true,"str_key":"val","nil_key":null,"list_key":[{"inner_key":"inner_val"}],"int_key":123},"timestampField":"2024-04-03T01:02:03Z","listValue":["F","Y","I"],"bareValue":45,"someInt":65,"someEnum":"TEST_ENUM_FOO"})
105
+ })
106
+ end
107
+
108
+ it 'should be successful without the enum prefix' do
109
+ params[:some_enum] = 'FOO'
95
110
  post '/test4', params: params, as: :json
96
111
  expect(response).to be_successful
97
112
  expect(response.parsed_body).to eq({
98
113
  'someInt' => 4,
99
- 'fullResponse' => %({"testId":"abc","foobar":"xyz","repeatedString":["W","T","F"],"subRecord":{"subId":"id1","anotherId":"id2"},"secondRecord":{"subId":"id3","anotherId":"id4"},"structField":{"bool_key":true,"str_key":"val","nil_key":null,"list_key":[{"inner_key":"inner_val"}],"int_key":123},"timestampField":"2024-04-03T01:02:03Z","listValue":["F","Y","I"],"bareValue":45,\"someInt\":65})
114
+ 'fullResponse' => %({"testId":"abc","foobar":"xyz","repeatedString":["W","T","F"],"subRecord":{"subId":"id1","anotherId":"id2"},"secondRecord":{"subId":"id3","anotherId":"id4"},"structField":{"bool_key":true,"str_key":"val","nil_key":null,"list_key":[{"inner_key":"inner_val"}],"int_key":123},"timestampField":"2024-04-03T01:02:03Z","listValue":["F","Y","I"],"bareValue":45,"someInt":65,"someEnum":"TEST_ENUM_FOO"})
100
115
  })
101
116
  end
102
117
  end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: protoc-gen-openapiv2/options/annotations.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/descriptor_pb'
8
+ require_relative './openapiv2_pb'
9
+
10
+ module ProtocGenOpenapiv2; end
11
+
12
+ descriptor_data = "\n.protoc-gen-openapiv2/options/annotations.proto\x12)grpc.gateway.protoc_gen_openapiv2.options\x1a google/protobuf/descriptor.proto\x1a,protoc-gen-openapiv2/options/openapiv2.proto:~\n\x11openapiv2_swagger\x12\x1c.google.protobuf.FileOptions\x18\x92\x08 \x01(\x0b\x32\x32.grpc.gateway.protoc_gen_openapiv2.options.SwaggerR\x10openapiv2Swagger:\x86\x01\n\x13openapiv2_operation\x12\x1e.google.protobuf.MethodOptions\x18\x92\x08 \x01(\x0b\x32\x34.grpc.gateway.protoc_gen_openapiv2.options.OperationR\x12openapiv2Operation:~\n\x10openapiv2_schema\x12\x1f.google.protobuf.MessageOptions\x18\x92\x08 \x01(\x0b\x32\x31.grpc.gateway.protoc_gen_openapiv2.options.SchemaR\x0fopenapiv2Schema:u\n\ropenapiv2_tag\x12\x1f.google.protobuf.ServiceOptions\x18\x92\x08 \x01(\x0b\x32..grpc.gateway.protoc_gen_openapiv2.options.TagR\x0copenapiv2Tag:~\n\x0fopenapiv2_field\x12\x1d.google.protobuf.FieldOptions\x18\x92\x08 \x01(\x0b\x32\x35.grpc.gateway.protoc_gen_openapiv2.options.JSONSchemaR\x0eopenapiv2FieldB\xdb\x02\n-com.grpc.gateway.protoc_gen_openapiv2.optionsB\x10\x41nnotationsProtoP\x01ZXbuf.build/gen/go/flipp/platform-entities/protocolbuffers/go/protoc-gen-openapiv2/options\xa2\x02\x04GGPO\xaa\x02\'Grpc.Gateway.ProtocGenOpenapiv2.Options\xca\x02\'Grpc\\Gateway\\ProtocGenOpenapiv2\\Options\xe2\x02\x33Grpc\\Gateway\\ProtocGenOpenapiv2\\Options\\GPBMetadata\xea\x02*Grpc::Gateway::ProtocGenOpenapiv2::Optionsb\x06proto3"
13
+
14
+ pool = Google::Protobuf::DescriptorPool.generated_pool
15
+
16
+ begin
17
+ pool.add_serialized_file(descriptor_data)
18
+ rescue TypeError => e
19
+ # Compatibility code: will be removed in the next major version.
20
+ require 'google/protobuf/descriptor_pb'
21
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
22
+ parsed.clear_dependency
23
+ serialized = parsed.class.encode(parsed)
24
+ file = pool.add_serialized_file(serialized)
25
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
26
+ imports = [
27
+ ["grpc.gateway.protoc_gen_openapiv2.options.Swagger", "protoc-gen-openapiv2/options/openapiv2.proto"],
28
+ ]
29
+ imports.each do |type_name, expected_filename|
30
+ import_file = pool.lookup(type_name).file_descriptor
31
+ if import_file.name != expected_filename
32
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
33
+ end
34
+ end
35
+ warn "Each proto file must use a consistent fully-qualified name."
36
+ warn "This will become an error in the next major version."
37
+ end
38
+
39
+ module Grpc
40
+ module Gateway
41
+ module ProtocGenOpenapiv2
42
+ module Options
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,70 @@
1
+ # frozen_string_literal: true
2
+ # Generated by the protocol buffer compiler. DO NOT EDIT!
3
+ # source: protoc-gen-openapiv2/options/openapiv2.proto
4
+
5
+ require 'google/protobuf'
6
+
7
+ require 'google/protobuf/struct_pb'
8
+
9
+ module ProtocGenOpenapiv2; end
10
+
11
+ descriptor_data = "\n,protoc-gen-openapiv2/options/openapiv2.proto\x12)grpc.gateway.protoc_gen_openapiv2.options\x1a\x1cgoogle/protobuf/struct.proto\"\xb3\x08\n\x07Swagger\x12\x18\n\x07swagger\x18\x01 \x01(\tR\x07swagger\x12\x43\n\x04info\x18\x02 \x01(\x0b\x32/.grpc.gateway.protoc_gen_openapiv2.options.InfoR\x04info\x12\x12\n\x04host\x18\x03 \x01(\tR\x04host\x12\x1b\n\tbase_path\x18\x04 \x01(\tR\x08\x62\x61sePath\x12K\n\x07schemes\x18\x05 \x03(\x0e\x32\x31.grpc.gateway.protoc_gen_openapiv2.options.SchemeR\x07schemes\x12\x1a\n\x08\x63onsumes\x18\x06 \x03(\tR\x08\x63onsumes\x12\x1a\n\x08produces\x18\x07 \x03(\tR\x08produces\x12_\n\tresponses\x18\n \x03(\x0b\x32\x41.grpc.gateway.protoc_gen_openapiv2.options.Swagger.ResponsesEntryR\tresponses\x12q\n\x14security_definitions\x18\x0b \x01(\x0b\x32>.grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitionsR\x13securityDefinitions\x12Z\n\x08security\x18\x0c \x03(\x0b\x32>.grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirementR\x08security\x12\x42\n\x04tags\x18\r \x03(\x0b\x32..grpc.gateway.protoc_gen_openapiv2.options.TagR\x04tags\x12\x65\n\rexternal_docs\x18\x0e \x01(\x0b\x32@.grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentationR\x0c\x65xternalDocs\x12\x62\n\nextensions\x18\x0f \x03(\x0b\x32\x42.grpc.gateway.protoc_gen_openapiv2.options.Swagger.ExtensionsEntryR\nextensions\x1aq\n\x0eResponsesEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12I\n\x05value\x18\x02 \x01(\x0b\x32\x33.grpc.gateway.protoc_gen_openapiv2.options.ResponseR\x05value:\x02\x38\x01\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01J\x04\x08\x08\x10\tJ\x04\x08\t\x10\n\"\xd6\x07\n\tOperation\x12\x12\n\x04tags\x18\x01 \x03(\tR\x04tags\x12\x18\n\x07summary\x18\x02 \x01(\tR\x07summary\x12 \n\x0b\x64\x65scription\x18\x03 \x01(\tR\x0b\x64\x65scription\x12\x65\n\rexternal_docs\x18\x04 \x01(\x0b\x32@.grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentationR\x0c\x65xternalDocs\x12!\n\x0coperation_id\x18\x05 \x01(\tR\x0boperationId\x12\x1a\n\x08\x63onsumes\x18\x06 \x03(\tR\x08\x63onsumes\x12\x1a\n\x08produces\x18\x07 \x03(\tR\x08produces\x12\x61\n\tresponses\x18\t \x03(\x0b\x32\x43.grpc.gateway.protoc_gen_openapiv2.options.Operation.ResponsesEntryR\tresponses\x12K\n\x07schemes\x18\n \x03(\x0e\x32\x31.grpc.gateway.protoc_gen_openapiv2.options.SchemeR\x07schemes\x12\x1e\n\ndeprecated\x18\x0b \x01(\x08R\ndeprecated\x12Z\n\x08security\x18\x0c \x03(\x0b\x32>.grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirementR\x08security\x12\x64\n\nextensions\x18\r \x03(\x0b\x32\x44.grpc.gateway.protoc_gen_openapiv2.options.Operation.ExtensionsEntryR\nextensions\x12U\n\nparameters\x18\x0e \x01(\x0b\x32\x35.grpc.gateway.protoc_gen_openapiv2.options.ParametersR\nparameters\x1aq\n\x0eResponsesEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12I\n\x05value\x18\x02 \x01(\x0b\x32\x33.grpc.gateway.protoc_gen_openapiv2.options.ResponseR\x05value:\x02\x38\x01\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01J\x04\x08\x08\x10\t\"b\n\nParameters\x12T\n\x07headers\x18\x01 \x03(\x0b\x32:.grpc.gateway.protoc_gen_openapiv2.options.HeaderParameterR\x07headers\"\xa3\x02\n\x0fHeaderParameter\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12S\n\x04type\x18\x03 \x01(\x0e\x32?.grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter.TypeR\x04type\x12\x16\n\x06\x66ormat\x18\x04 \x01(\tR\x06\x66ormat\x12\x1a\n\x08required\x18\x05 \x01(\x08R\x08required\"E\n\x04Type\x12\x0b\n\x07UNKNOWN\x10\x00\x12\n\n\x06STRING\x10\x01\x12\n\n\x06NUMBER\x10\x02\x12\x0b\n\x07INTEGER\x10\x03\x12\x0b\n\x07\x42OOLEAN\x10\x04J\x04\x08\x06\x10\x07J\x04\x08\x07\x10\x08\"\xd8\x01\n\x06Header\x12 \n\x0b\x64\x65scription\x18\x01 \x01(\tR\x0b\x64\x65scription\x12\x12\n\x04type\x18\x02 \x01(\tR\x04type\x12\x16\n\x06\x66ormat\x18\x03 \x01(\tR\x06\x66ormat\x12\x18\n\x07\x64\x65\x66\x61ult\x18\x06 \x01(\tR\x07\x64\x65\x66\x61ult\x12\x18\n\x07pattern\x18\r \x01(\tR\x07patternJ\x04\x08\x04\x10\x05J\x04\x08\x05\x10\x06J\x04\x08\x07\x10\x08J\x04\x08\x08\x10\tJ\x04\x08\t\x10\nJ\x04\x08\n\x10\x0bJ\x04\x08\x0b\x10\x0cJ\x04\x08\x0c\x10\rJ\x04\x08\x0e\x10\x0fJ\x04\x08\x0f\x10\x10J\x04\x08\x10\x10\x11J\x04\x08\x11\x10\x12J\x04\x08\x12\x10\x13\"\x9a\x05\n\x08Response\x12 \n\x0b\x64\x65scription\x18\x01 \x01(\tR\x0b\x64\x65scription\x12I\n\x06schema\x18\x02 \x01(\x0b\x32\x31.grpc.gateway.protoc_gen_openapiv2.options.SchemaR\x06schema\x12Z\n\x07headers\x18\x03 \x03(\x0b\x32@.grpc.gateway.protoc_gen_openapiv2.options.Response.HeadersEntryR\x07headers\x12]\n\x08\x65xamples\x18\x04 \x03(\x0b\x32\x41.grpc.gateway.protoc_gen_openapiv2.options.Response.ExamplesEntryR\x08\x65xamples\x12\x63\n\nextensions\x18\x05 \x03(\x0b\x32\x43.grpc.gateway.protoc_gen_openapiv2.options.Response.ExtensionsEntryR\nextensions\x1am\n\x0cHeadersEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12G\n\x05value\x18\x02 \x01(\x0b\x32\x31.grpc.gateway.protoc_gen_openapiv2.options.HeaderR\x05value:\x02\x38\x01\x1a;\n\rExamplesEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01\"\xd6\x03\n\x04Info\x12\x14\n\x05title\x18\x01 \x01(\tR\x05title\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12(\n\x10terms_of_service\x18\x03 \x01(\tR\x0etermsOfService\x12L\n\x07\x63ontact\x18\x04 \x01(\x0b\x32\x32.grpc.gateway.protoc_gen_openapiv2.options.ContactR\x07\x63ontact\x12L\n\x07license\x18\x05 \x01(\x0b\x32\x32.grpc.gateway.protoc_gen_openapiv2.options.LicenseR\x07license\x12\x18\n\x07version\x18\x06 \x01(\tR\x07version\x12_\n\nextensions\x18\x07 \x03(\x0b\x32?.grpc.gateway.protoc_gen_openapiv2.options.Info.ExtensionsEntryR\nextensions\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01\"E\n\x07\x43ontact\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n\x03url\x18\x02 \x01(\tR\x03url\x12\x14\n\x05\x65mail\x18\x03 \x01(\tR\x05\x65mail\"/\n\x07License\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12\x10\n\x03url\x18\x02 \x01(\tR\x03url\"K\n\x15\x45xternalDocumentation\x12 \n\x0b\x64\x65scription\x18\x01 \x01(\tR\x0b\x64\x65scription\x12\x10\n\x03url\x18\x02 \x01(\tR\x03url\"\xaa\x02\n\x06Schema\x12V\n\x0bjson_schema\x18\x01 \x01(\x0b\x32\x35.grpc.gateway.protoc_gen_openapiv2.options.JSONSchemaR\njsonSchema\x12$\n\rdiscriminator\x18\x02 \x01(\tR\rdiscriminator\x12\x1b\n\tread_only\x18\x03 \x01(\x08R\x08readOnly\x12\x65\n\rexternal_docs\x18\x05 \x01(\x0b\x32@.grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentationR\x0c\x65xternalDocs\x12\x18\n\x07\x65xample\x18\x06 \x01(\tR\x07\x65xampleJ\x04\x08\x04\x10\x05\"\xd7\n\n\nJSONSchema\x12\x10\n\x03ref\x18\x03 \x01(\tR\x03ref\x12\x14\n\x05title\x18\x05 \x01(\tR\x05title\x12 \n\x0b\x64\x65scription\x18\x06 \x01(\tR\x0b\x64\x65scription\x12\x18\n\x07\x64\x65\x66\x61ult\x18\x07 \x01(\tR\x07\x64\x65\x66\x61ult\x12\x1b\n\tread_only\x18\x08 \x01(\x08R\x08readOnly\x12\x18\n\x07\x65xample\x18\t \x01(\tR\x07\x65xample\x12\x1f\n\x0bmultiple_of\x18\n \x01(\x01R\nmultipleOf\x12\x18\n\x07maximum\x18\x0b \x01(\x01R\x07maximum\x12+\n\x11\x65xclusive_maximum\x18\x0c \x01(\x08R\x10\x65xclusiveMaximum\x12\x18\n\x07minimum\x18\r \x01(\x01R\x07minimum\x12+\n\x11\x65xclusive_minimum\x18\x0e \x01(\x08R\x10\x65xclusiveMinimum\x12\x1d\n\nmax_length\x18\x0f \x01(\x04R\tmaxLength\x12\x1d\n\nmin_length\x18\x10 \x01(\x04R\tminLength\x12\x18\n\x07pattern\x18\x11 \x01(\tR\x07pattern\x12\x1b\n\tmax_items\x18\x14 \x01(\x04R\x08maxItems\x12\x1b\n\tmin_items\x18\x15 \x01(\x04R\x08minItems\x12!\n\x0cunique_items\x18\x16 \x01(\x08R\x0buniqueItems\x12%\n\x0emax_properties\x18\x18 \x01(\x04R\rmaxProperties\x12%\n\x0emin_properties\x18\x19 \x01(\x04R\rminProperties\x12\x1a\n\x08required\x18\x1a \x03(\tR\x08required\x12\x14\n\x05\x61rray\x18\" \x03(\tR\x05\x61rray\x12_\n\x04type\x18# \x03(\x0e\x32K.grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.JSONSchemaSimpleTypesR\x04type\x12\x16\n\x06\x66ormat\x18$ \x01(\tR\x06\x66ormat\x12\x12\n\x04\x65num\x18. \x03(\tR\x04\x65num\x12z\n\x13\x66ield_configuration\x18\xe9\x07 \x01(\x0b\x32H.grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.FieldConfigurationR\x12\x66ieldConfiguration\x12\x65\n\nextensions\x18\x30 \x03(\x0b\x32\x45.grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.ExtensionsEntryR\nextensions\x1a<\n\x12\x46ieldConfiguration\x12&\n\x0fpath_param_name\x18/ \x01(\tR\rpathParamName\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01\"w\n\x15JSONSchemaSimpleTypes\x12\x0b\n\x07UNKNOWN\x10\x00\x12\t\n\x05\x41RRAY\x10\x01\x12\x0b\n\x07\x42OOLEAN\x10\x02\x12\x0b\n\x07INTEGER\x10\x03\x12\x08\n\x04NULL\x10\x04\x12\n\n\x06NUMBER\x10\x05\x12\n\n\x06OBJECT\x10\x06\x12\n\n\x06STRING\x10\x07J\x04\x08\x01\x10\x02J\x04\x08\x02\x10\x03J\x04\x08\x04\x10\x05J\x04\x08\x12\x10\x13J\x04\x08\x13\x10\x14J\x04\x08\x17\x10\x18J\x04\x08\x1b\x10\x1cJ\x04\x08\x1c\x10\x1dJ\x04\x08\x1d\x10\x1eJ\x04\x08\x1e\x10\"J\x04\x08%\x10*J\x04\x08*\x10+J\x04\x08+\x10.\"\xd9\x02\n\x03Tag\x12\x12\n\x04name\x18\x01 \x01(\tR\x04name\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12\x65\n\rexternal_docs\x18\x03 \x01(\x0b\x32@.grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentationR\x0c\x65xternalDocs\x12^\n\nextensions\x18\x04 \x03(\x0b\x32>.grpc.gateway.protoc_gen_openapiv2.options.Tag.ExtensionsEntryR\nextensions\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01\"\xf7\x01\n\x13SecurityDefinitions\x12h\n\x08security\x18\x01 \x03(\x0b\x32L.grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions.SecurityEntryR\x08security\x1av\n\rSecurityEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12O\n\x05value\x18\x02 \x01(\x0b\x32\x39.grpc.gateway.protoc_gen_openapiv2.options.SecuritySchemeR\x05value:\x02\x38\x01\"\xff\x06\n\x0eSecurityScheme\x12R\n\x04type\x18\x01 \x01(\x0e\x32>.grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.TypeR\x04type\x12 \n\x0b\x64\x65scription\x18\x02 \x01(\tR\x0b\x64\x65scription\x12\x12\n\x04name\x18\x03 \x01(\tR\x04name\x12L\n\x02in\x18\x04 \x01(\x0e\x32<.grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.InR\x02in\x12R\n\x04\x66low\x18\x05 \x01(\x0e\x32>.grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.FlowR\x04\x66low\x12+\n\x11\x61uthorization_url\x18\x06 \x01(\tR\x10\x61uthorizationUrl\x12\x1b\n\ttoken_url\x18\x07 \x01(\tR\x08tokenUrl\x12I\n\x06scopes\x18\x08 \x01(\x0b\x32\x31.grpc.gateway.protoc_gen_openapiv2.options.ScopesR\x06scopes\x12i\n\nextensions\x18\t \x03(\x0b\x32I.grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.ExtensionsEntryR\nextensions\x1aU\n\x0f\x45xtensionsEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12,\n\x05value\x18\x02 \x01(\x0b\x32\x16.google.protobuf.ValueR\x05value:\x02\x38\x01\"K\n\x04Type\x12\x10\n\x0cTYPE_INVALID\x10\x00\x12\x0e\n\nTYPE_BASIC\x10\x01\x12\x10\n\x0cTYPE_API_KEY\x10\x02\x12\x0f\n\x0bTYPE_OAUTH2\x10\x03\"1\n\x02In\x12\x0e\n\nIN_INVALID\x10\x00\x12\x0c\n\x08IN_QUERY\x10\x01\x12\r\n\tIN_HEADER\x10\x02\"j\n\x04\x46low\x12\x10\n\x0c\x46LOW_INVALID\x10\x00\x12\x11\n\rFLOW_IMPLICIT\x10\x01\x12\x11\n\rFLOW_PASSWORD\x10\x02\x12\x14\n\x10\x46LOW_APPLICATION\x10\x03\x12\x14\n\x10\x46LOW_ACCESS_CODE\x10\x04\"\xf6\x02\n\x13SecurityRequirement\x12\x8a\x01\n\x14security_requirement\x18\x01 \x03(\x0b\x32W.grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementEntryR\x13securityRequirement\x1a\x30\n\x18SecurityRequirementValue\x12\x14\n\x05scope\x18\x01 \x03(\tR\x05scope\x1a\x9f\x01\n\x18SecurityRequirementEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12m\n\x05value\x18\x02 \x01(\x0b\x32W.grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementValueR\x05value:\x02\x38\x01\"\x96\x01\n\x06Scopes\x12R\n\x05scope\x18\x01 \x03(\x0b\x32<.grpc.gateway.protoc_gen_openapiv2.options.Scopes.ScopeEntryR\x05scope\x1a\x38\n\nScopeEntry\x12\x10\n\x03key\x18\x01 \x01(\tR\x03key\x12\x14\n\x05value\x18\x02 \x01(\tR\x05value:\x02\x38\x01*;\n\x06Scheme\x12\x0b\n\x07UNKNOWN\x10\x00\x12\x08\n\x04HTTP\x10\x01\x12\t\n\x05HTTPS\x10\x02\x12\x06\n\x02WS\x10\x03\x12\x07\n\x03WSS\x10\x04\x42\xd9\x02\n-com.grpc.gateway.protoc_gen_openapiv2.optionsB\x0eOpenapiv2ProtoP\x01ZXbuf.build/gen/go/flipp/platform-entities/protocolbuffers/go/protoc-gen-openapiv2/options\xa2\x02\x04GGPO\xaa\x02\'Grpc.Gateway.ProtocGenOpenapiv2.Options\xca\x02\'Grpc\\Gateway\\ProtocGenOpenapiv2\\Options\xe2\x02\x33Grpc\\Gateway\\ProtocGenOpenapiv2\\Options\\GPBMetadata\xea\x02*Grpc::Gateway::ProtocGenOpenapiv2::Optionsb\x06proto3"
12
+
13
+ pool = Google::Protobuf::DescriptorPool.generated_pool
14
+
15
+ begin
16
+ pool.add_serialized_file(descriptor_data)
17
+ rescue TypeError => e
18
+ # Compatibility code: will be removed in the next major version.
19
+ require 'google/protobuf/descriptor_pb'
20
+ parsed = Google::Protobuf::FileDescriptorProto.decode(descriptor_data)
21
+ parsed.clear_dependency
22
+ serialized = parsed.class.encode(parsed)
23
+ file = pool.add_serialized_file(serialized)
24
+ warn "Warning: Protobuf detected an import path issue while loading generated file #{__FILE__}"
25
+ imports = [
26
+ ["google.protobuf.Value", "google/protobuf/struct.proto"],
27
+ ]
28
+ imports.each do |type_name, expected_filename|
29
+ import_file = pool.lookup(type_name).file_descriptor
30
+ if import_file.name != expected_filename
31
+ warn "- #{file.name} imports #{expected_filename}, but that import was loaded as #{import_file.name}"
32
+ end
33
+ end
34
+ warn "Each proto file must use a consistent fully-qualified name."
35
+ warn "This will become an error in the next major version."
36
+ end
37
+
38
+ module Grpc
39
+ module Gateway
40
+ module ProtocGenOpenapiv2
41
+ module Options
42
+ Swagger = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Swagger").msgclass
43
+ Operation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Operation").msgclass
44
+ Parameters = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Parameters").msgclass
45
+ HeaderParameter = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter").msgclass
46
+ HeaderParameter::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.HeaderParameter.Type").enummodule
47
+ Header = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Header").msgclass
48
+ Response = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Response").msgclass
49
+ Info = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Info").msgclass
50
+ Contact = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Contact").msgclass
51
+ License = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.License").msgclass
52
+ ExternalDocumentation = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.ExternalDocumentation").msgclass
53
+ Schema = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Schema").msgclass
54
+ JSONSchema = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.JSONSchema").msgclass
55
+ JSONSchema::FieldConfiguration = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.FieldConfiguration").msgclass
56
+ JSONSchema::JSONSchemaSimpleTypes = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.JSONSchema.JSONSchemaSimpleTypes").enummodule
57
+ Tag = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Tag").msgclass
58
+ SecurityDefinitions = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityDefinitions").msgclass
59
+ SecurityScheme = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme").msgclass
60
+ SecurityScheme::Type = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.Type").enummodule
61
+ SecurityScheme::In = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.In").enummodule
62
+ SecurityScheme::Flow = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityScheme.Flow").enummodule
63
+ SecurityRequirement = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement").msgclass
64
+ SecurityRequirement::SecurityRequirementValue = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.SecurityRequirement.SecurityRequirementValue").msgclass
65
+ Scopes = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Scopes").msgclass
66
+ Scheme = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("grpc.gateway.protoc_gen_openapiv2.options.Scheme").enummodule
67
+ end
68
+ end
69
+ end
70
+ end
data/spec/spec_helper.rb CHANGED
@@ -11,6 +11,13 @@ GrpcApp.initialize!
11
11
 
12
12
  require 'rspec/rails'
13
13
 
14
+ loader = Zeitwerk::Loader.new
15
+ loader.push_dir('./spec')
16
+ loader.inflector.inflect('protoc-gen-openapiv2' => 'ProtocGenOpenapiv2')
17
+ loader.ignore("#{Rails.root}/spec/test_service_pb.rb")
18
+ loader.setup
19
+ require "#{Rails.root}/spec/test_service_pb.rb"
20
+
14
21
  $LOAD_PATH.unshift(File.expand_path('../lib', __dir__))
15
22
 
16
23
  RSpec.configure do |config|
@@ -7,9 +7,10 @@ require 'google/protobuf'
7
7
  require 'google/api/annotations_pb'
8
8
  require 'google/protobuf/struct_pb'
9
9
  require 'google/protobuf/timestamp_pb'
10
+ require 'protoc-gen-openapiv2/options/annotations_pb'
10
11
 
11
12
 
12
- descriptor_data = "\n\x12test_service.proto\x12\x08testdata\x1a\x1cgoogle/api/annotations.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\"\x98\x03\n\x0bTestRequest\x12\x0f\n\x07test_id\x18\x01 \x01(\t\x12\x0e\n\x06\x66oobar\x18\x02 \x01(\t\x12\x17\n\x0frepeated_string\x18\x03 \x03(\t\x12\'\n\nsub_record\x18\x04 \x01(\x0b\x32\x13.testdata.SubRecord\x12*\n\rsecond_record\x18\x05 \x01(\x0b\x32\x13.testdata.SubRecord\x12-\n\x0cstruct_field\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x33\n\x0ftimestamp_field\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nlist_value\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.ListValue\x12*\n\nbare_value\x18\t \x01(\x0b\x32\x16.google.protobuf.Value\x12(\n\x0bsub_records\x18\n \x03(\x0b\x32\x13.testdata.SubRecord\x12\x10\n\x08some_int\x18\x0b \x01(\x05\"/\n\tSubRecord\x12\x0e\n\x06sub_id\x18\x01 \x01(\t\x12\x12\n\nanother_id\x18\x02 \x01(\t\"7\n\x0cTestResponse\x12\x10\n\x08some_int\x18\x01 \x01(\x05\x12\x15\n\rfull_response\x18\x02 \x01(\t2\xdf\x02\n\tMyService\x12T\n\x04Test\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\x12\x15/test/{foobar=blah/*}\x12U\n\x05Test2\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x06/test2:\rsecond_record\x12Z\n\x05Test3\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\"\x82\xd3\xe4\x93\x02\x1c\"\x1a/test3/{sub_record.sub_id}\x12I\n\x05Test4\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\x11\x82\xd3\xe4\x93\x02\x0b\"\x06/test4:\x01*b\x06proto3"
13
+ descriptor_data = "\n\x12test_service.proto\x12\x08testdata\x1a\x1cgoogle/api/annotations.proto\x1a\x1cgoogle/protobuf/struct.proto\x1a\x1fgoogle/protobuf/timestamp.proto\x1a.protoc-gen-openapiv2/options/annotations.proto\"\xbf\x03\n\x0bTestRequest\x12\x0f\n\x07test_id\x18\x01 \x01(\t\x12\x0e\n\x06\x66oobar\x18\x02 \x01(\t\x12\x17\n\x0frepeated_string\x18\x03 \x03(\t\x12\'\n\nsub_record\x18\x04 \x01(\x0b\x32\x13.testdata.SubRecord\x12*\n\rsecond_record\x18\x05 \x01(\x0b\x32\x13.testdata.SubRecord\x12-\n\x0cstruct_field\x18\x06 \x01(\x0b\x32\x17.google.protobuf.Struct\x12\x33\n\x0ftimestamp_field\x18\x07 \x01(\x0b\x32\x1a.google.protobuf.Timestamp\x12.\n\nlist_value\x18\x08 \x01(\x0b\x32\x1a.google.protobuf.ListValue\x12*\n\nbare_value\x18\t \x01(\x0b\x32\x16.google.protobuf.Value\x12(\n\x0bsub_records\x18\n \x03(\x0b\x32\x13.testdata.SubRecord\x12\x10\n\x08some_int\x18\x0b \x01(\x05\x12%\n\tsome_enum\x18\x0c \x01(\x0e\x32\x12.testdata.TestEnum\"/\n\tSubRecord\x12\x0e\n\x06sub_id\x18\x01 \x01(\t\x12\x12\n\nanother_id\x18\x02 \x01(\t\"L\n\x0cTestResponse\x12\x10\n\x08some_int\x18\x01 \x01(\x05\x12\x15\n\rfull_response\x18\x02 \x01(\t\x12\x13\n\x0bignored_key\x18\x03 \x01(\t*K\n\x08TestEnum\x12\x19\n\x15TEST_ENUM_UNSPECIFIED\x10\x00\x12\x11\n\rTEST_ENUM_FOO\x10\x01\x12\x11\n\rTEST_ENUM_BAR\x10\x02\x32\x83\x03\n\tMyService\x12x\n\x04Test\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"A\x92\x41!j\x1f\n\x19x-grpc-rest-emit-defaults\x12\x02 \x01\x82\xd3\xe4\x93\x02\x17\x12\x15/test/{foobar=blah/*}\x12U\n\x05Test2\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\x1d\x82\xd3\xe4\x93\x02\x17\"\x06/test2:\rsecond_record\x12Z\n\x05Test3\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\"\x82\xd3\xe4\x93\x02\x1c\"\x1a/test3/{sub_record.sub_id}\x12I\n\x05Test4\x12\x15.testdata.TestRequest\x1a\x16.testdata.TestResponse\"\x11\x82\xd3\xe4\x93\x02\x0b\"\x06/test4:\x01*b\x06proto3"
13
14
 
14
15
  pool = Google::Protobuf::DescriptorPool.generated_pool
15
16
  pool.add_serialized_file(descriptor_data)
@@ -18,4 +19,5 @@ module Testdata
18
19
  TestRequest = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("testdata.TestRequest").msgclass
19
20
  SubRecord = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("testdata.SubRecord").msgclass
20
21
  TestResponse = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("testdata.TestResponse").msgclass
22
+ TestEnum = ::Google::Protobuf::DescriptorPool.generated_pool.lookup("testdata.TestEnum").enummodule
21
23
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grpc-rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.17
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Orner
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-30 00:00:00.000000000 Z
11
+ date: 2024-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: grpc
@@ -75,6 +75,8 @@ files:
75
75
  - protoc-gen-rails/go.sum
76
76
  - protoc-gen-rails/google-deps/google/api/annotations.proto
77
77
  - protoc-gen-rails/google-deps/google/api/http.proto
78
+ - protoc-gen-rails/google-deps/protoc-gen-openapiv2/options/annotations.proto
79
+ - protoc-gen-rails/google-deps/protoc-gen-openapiv2/options/openapiv2.proto
78
80
  - protoc-gen-rails/internal/output.go
79
81
  - protoc-gen-rails/internal/parse.go
80
82
  - protoc-gen-rails/internal/utils.go
@@ -86,6 +88,8 @@ files:
86
88
  - protoc-gen-rails/testdata/test.proto
87
89
  - protoc-gen-rails/testdata/test_service.proto
88
90
  - spec/grpc_rest_spec.rb
91
+ - spec/protoc-gen-openapiv2/options/annotations_pb.rb
92
+ - spec/protoc-gen-openapiv2/options/openapiv2_pb.rb
89
93
  - spec/spec_helper.rb
90
94
  - spec/test_service_pb.rb
91
95
  - spec/test_service_services_pb.rb
@@ -114,6 +118,8 @@ specification_version: 4
114
118
  summary: Generate Rails controllers and routes from gRPC definitions.
115
119
  test_files:
116
120
  - spec/grpc_rest_spec.rb
121
+ - spec/protoc-gen-openapiv2/options/annotations_pb.rb
122
+ - spec/protoc-gen-openapiv2/options/openapiv2_pb.rb
117
123
  - spec/spec_helper.rb
118
124
  - spec/test_service_pb.rb
119
125
  - spec/test_service_services_pb.rb