{"action":"created","issue":{"url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/521","repository_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway","labels_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/521/labels{/name}","comments_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/521/comments","events_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/521/events","html_url":"https://github.com/grpc-ecosystem/grpc-gateway/pull/521","id":288391971,"number":521,"title":"[WIP] Add support for basic gRPC API Configuration YAML files","user":{"login":"hacst","id":237537,"avatar_url":"https://avatars3.githubusercontent.com/u/237537?v=4","gravatar_id":"","url":"https://api.github.com/users/hacst","html_url":"https://github.com/hacst","followers_url":"https://api.github.com/users/hacst/followers","following_url":"https://api.github.com/users/hacst/following{/other_user}","gists_url":"https://api.github.com/users/hacst/gists{/gist_id}","starred_url":"https://api.github.com/users/hacst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hacst/subscriptions","organizations_url":"https://api.github.com/users/hacst/orgs","repos_url":"https://api.github.com/users/hacst/repos","events_url":"https://api.github.com/users/hacst/events{/privacy}","received_events_url":"https://api.github.com/users/hacst/received_events","type":"User","site_admin":false},"labels":[{"id":816045899,"url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/labels/cla:%20yes","name":"cla: yes","color":"0e8a16","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":14,"created_at":"2018-01-14T08:27:58Z","updated_at":"2018-04-23T21:48:17Z","closed_at":null,"author_association":"NONE","pull_request":{"url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/pulls/521","html_url":"https://github.com/grpc-ecosystem/grpc-gateway/pull/521","diff_url":"https://github.com/grpc-ecosystem/grpc-gateway/pull/521.diff","patch_url":"https://github.com/grpc-ecosystem/grpc-gateway/pull/521.patch"},"body":"Sometimes the requirement to have to annotate your .proto files to expose them using grpc-gateway can be inconvenient. For one all your backends and clients using the .proto now need to know the google api types for the annotation which can be a hassle. More importantly in a number of situations you cannot/do not want to change the .proto at all (e.g. if you don't own the .proto or only want to use the gateway for experiments).\r\n\r\nGoogle offers a way to achieve this for services hosted with them called \"gRPC API Configuration\" files. This PR implements a small part of those for grpc-gateway:\r\n\r\n> Add support for basic gRPC API Configuration YAML files\r\n>\r\n> Separate gRPC API Configuration files as described by google at\r\n> https://cloud.google.com/endpoints/docs/grpc/grpc-service-config\r\n> can be used to separate the description of the basic API surface\r\n> in .proto files from their mapping to HTTP REST. In grpc-gateway\r\n> this allows exposing gRPC services without having to add any\r\n> annotations to their .proto files.\r\n> \r\n> The format of gRPC API Configuration YAML files is defined by the\r\n> proto message schema google.api.service which can be found as\r\n> service.proto in the googleapis repository. This patch exposes\r\n> the Http part of the service configuration to the gateway\r\n> generator.\r\n> \r\n> To enable this all HttpRules contained in the Http part of the\r\n> description are loaded into the generator registry as a map from\r\n> service method to HttpRules called externalHttpRules. During\r\n> loading of the proto files we can now use these externalHttpRules\r\n> to look for additional rules to apply to a service method in addition\r\n> to the ones from the annotations found in the proto file. As the\r\n> types are the same no fundamentally new codepaths are required in\r\n> either of the generators.\r\n> \r\n> google.api.service is quite a complex protobuf message with lots\r\n> of dependencies on other google api. To not have to pull in all\r\n> other dependent types this patch constructs a reduced service\r\n> message type with only the Http field. This relies on protobufs\r\n> backwards compatibility guarantees which allows us to remove all\r\n> other fields. Also we do not need all protobuf features on this\r\n> custom message.\r\n> \r\n> To load the actual YAML file as a protobuf message this patch uses\r\n> a new dependency on github.com/ghodss/yaml to convert the YAML into\r\n> JSON which we can then unmarshal into protobuf using jsonpb.\r\n\r\nThe code already works quite nicely for what I had in mind but before doing the boring parts of completing test coverage and examples I wanted to gauge interest in integrating this feature as well as get some feedback on the approach taken."},"comment":{"url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/comments/383734073","html_url":"https://github.com/grpc-ecosystem/grpc-gateway/pull/521#issuecomment-383734073","issue_url":"https://api.github.com/repos/grpc-ecosystem/grpc-gateway/issues/521","id":383734073,"user":{"login":"codecov-io","id":8655789,"avatar_url":"https://avatars0.githubusercontent.com/u/8655789?v=4","gravatar_id":"","url":"https://api.github.com/users/codecov-io","html_url":"https://github.com/codecov-io","followers_url":"https://api.github.com/users/codecov-io/followers","following_url":"https://api.github.com/users/codecov-io/following{/other_user}","gists_url":"https://api.github.com/users/codecov-io/gists{/gist_id}","starred_url":"https://api.github.com/users/codecov-io/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codecov-io/subscriptions","organizations_url":"https://api.github.com/users/codecov-io/orgs","repos_url":"https://api.github.com/users/codecov-io/repos","events_url":"https://api.github.com/users/codecov-io/events{/privacy}","received_events_url":"https://api.github.com/users/codecov-io/received_events","type":"User","site_admin":false},"created_at":"2018-04-23T21:48:17Z","updated_at":"2018-04-23T21:48:17Z","author_association":"NONE","body":"# [Codecov](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521?src=pr&el=h1) Report\n> :exclamation: No coverage uploaded for pull request base (`master@e8bd377`). [Click here to learn what that means](https://docs.codecov.io/docs/error-reference#section-missing-base-commit).\n> The diff coverage is `57.14%`.\n\n[![Impacted file tree graph](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/graphs/tree.svg?src=pr&width=650&height=150&token=Xei5jgF75L)](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521?src=pr&el=tree)\n\n```diff\n@@            Coverage Diff            @@\n##             master     #521   +/-   ##\n=========================================\n  Coverage          ?   58.66%           \n=========================================\n  Files             ?       31           \n  Lines             ?     2898           \n  Branches          ?        0           \n=========================================\n  Hits              ?     1700           \n  Misses            ?     1032           \n  Partials          ?      166\n```\n\n\n| [Impacted Files](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521?src=pr&el=tree) | Coverage Δ | |\n|---|---|---|\n| [protoc-gen-swagger/main.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1zd2FnZ2VyL21haW4uZ28=) | `25.97% <0%> (ø)` | |\n| [...oc-gen-grpc-gateway/descriptor/grpc\\_api\\_service.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1ncnBjLWdhdGV3YXkvZGVzY3JpcHRvci9ncnBjX2FwaV9zZXJ2aWNlLmdv) | `0% <0%> (ø)` | |\n| [protoc-gen-grpc-gateway/descriptor/types.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1ncnBjLWdhdGV3YXkvZGVzY3JpcHRvci90eXBlcy5nbw==) | `54.83% <100%> (ø)` | |\n| [protoc-gen-grpc-gateway/gengateway/generator.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1ncnBjLWdhdGV3YXkvZ2VuZ2F0ZXdheS9nZW5lcmF0b3IuZ28=) | `41.79% <100%> (ø)` | |\n| [...-grpc-gateway/descriptor/grpc\\_api\\_configuration.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1ncnBjLWdhdGV3YXkvZGVzY3JpcHRvci9ncnBjX2FwaV9jb25maWd1cmF0aW9uLmdv) | `29.62% <29.62%> (ø)` | |\n| [protoc-gen-grpc-gateway/descriptor/services.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1ncnBjLWdhdGV3YXkvZGVzY3JpcHRvci9zZXJ2aWNlcy5nbw==) | `75.54% <76.19%> (ø)` | |\n| [protoc-gen-grpc-gateway/descriptor/registry.go](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521/diff?src=pr&el=tree#diff-cHJvdG9jLWdlbi1ncnBjLWdhdGV3YXkvZGVzY3JpcHRvci9yZWdpc3RyeS5nbw==) | `74.28% <80%> (ø)` | |\n\n------\n\n[Continue to review full report at Codecov](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521?src=pr&el=continue).\n> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)\n> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`\n> Powered by [Codecov](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521?src=pr&el=footer). Last update [e8bd377...f1a1d75](https://codecov.io/gh/grpc-ecosystem/grpc-gateway/pull/521?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).\n"}}
{"actor":{"display_login":"codecov-io"}}