dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.54k stars 25.31k forks source link

gRPC JSON transcoding documentation with Swagger / OpenAPI is not precise #33126

Open linuxchata opened 1 month ago

linuxchata commented 1 month ago

Description

This documentation is not working out of the box.

The following adjustments had to made to make it working

  1. Add google/api/http.proto and google/api/annotations.proto files to a project as per https://learn.microsoft.com/en-us/aspnet/core/grpc/json-transcoding-binding?view=aspnetcore-8.0#http-rules. These files should be not be compiled (attribute ProtoCompile="false" should be added in a project file) as per https://stackoverflow.com/a/76090763/721440
  2. The following import must be added import "google/api/annotations.proto"; in my proto files as per https://learn.microsoft.com/en-us/aspnet/core/grpc/json-transcoding-binding?view=aspnetcore-8.0#http-rules
  3. <IncludeHttpRuleProtos>true</IncludeHttpRuleProtos> must be added to a project file as per https://learn.microsoft.com/en-us/aspnet/core/grpc/json-transcoding?view=aspnetcore-8.0&source=recommendations#usage

Packages

Grpc.AspNetCore Version is "2.64.0" Microsoft.AspNetCore.Grpc.Swagger Version is "0.8.7"

Page URL

https://learn.microsoft.com/en-us/aspnet/core/grpc/json-transcoding-openapi?view=aspnetcore-8.0

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/grpc/json-transcoding-openapi.md

Document ID

aeb8fe2e-a57e-74ff-f9d7-3591f24db367

Article author

@JamesNK

wadepickett commented 1 month ago

Related to effort here #32477. Review the latest before proceeding.