grpc-gateway v2.14.0 版本更新介绍
发布日期: 2022-11-15
版本号: v2.14.0
本次版本更新主要包含由@krak3n贡献的两项OpenAPIv2生成器新功能:一是新增禁用默认200 OK响应渲染的选项,适用于已自定义端点响应并修改返回码的场景;二是支持通过注解定义Swagger.json输出中的请求头参数,需配合应用层的自定义解析逻辑。此外,其他变更包括优化发布流程配置、清理代码库、修复路径组件异常及请求消费类型设置问题等,涉及@asraa、@sashamelentyev等多位贡献者的提交。此次版本还迎来了@asraa、@sashamelentyev、@stomy13和@krak3n四位新贡献者的首次参与。
更新内容 (中文)
新特性
此版本包含两个由 @krak3n 贡献的重要 OpenAPIv2 生成器新特性:
- 禁用 200 OK 响应渲染 的新选项。当您为端点定义自定义响应并修改转发响应编写器的返回码时,此功能非常有用。注意:此选项不会改变网关本身的行为。
- 定义头部参数 的新注解。该功能允许在 API 消息定义之外,额外指定需要渲染到 swagger.json 输出的头部参数。注意:此功能不会改变网关本身的行为,需与应用程序中的自定义头部解析配合使用。
变更内容
- release: 更新 release.yml 以支持绕过 SLSA 生成器故障的选项 / @asraa 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2987
- release: 添加 workflow_dispatch 触发器用于测试 / @asraa 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2989
- 使用 io/os 替代 ioutil 并优化格式动词 / @sashamelentyev 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2991
- 清理 runtime 包代码 / @sashamelentyev 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2993
- mux: 修复路径组件突变问题 / @jonathaningram 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3001
- fix: 按操作设置 consumes 定义 / @stomy13 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2995
- 清理 protoc-gen-oas v2 代码 / @sashamelentyev 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2996
- 使用 ReplaceAll 替代 Replace(-1) / @sashamelentyev 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3003
- 错误处理代码优化 / @sashamelentyev 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3004
- 代码清理 / @sashamelentyev 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3012
- 支持禁用默认响应渲染 / @krak3n 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3006
- 支持请求头部参数定义 / @krak3n 提交于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3010
新贡献者
- @asraa 首次贡献于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2987
- @sashamelentyev 首次贡献于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2991
- @stomy13 首次贡献于 https://github.com/grpc-ecosystem/grpc-gateway/pull/2995
- @krak3n 首次贡献于 https://github.com/grpc-ecosystem/grpc-gateway/pull/3006
完整变更日志: https://github.com/grpc-ecosystem/grpc-gateway/compare/v2.13.0...v2.14.0
更新内容 (原始)
New features
This release contains two significant new OpenAPIv2 generator features, contributed by @krak3n:
- A new option to disable rendering of 200 OK responses. This is useful if you define custom responses for your endpoints and you modify the return code a forward response writer. Note that this does not change the behavior of the gateway itself.
- A new annotation for defining header parameters. This lets to define header parameters you want to be rendered in the swagger.json output in addition to those defined in your API messages. Note that this does not change the behavior of the gateway itself and must be coupled with custom header parsing in your application.
What’s Changed
- release: Update release.yml with option to workaround SLSA generator failure by @asraa in https://github.com/grpc-ecosystem/grpc-gateway/pull/2987
- release: add a workflow_dispatch trigger for testing by @asraa in https://github.com/grpc-ecosystem/grpc-gateway/pull/2989
- Use io/os instread of ioutil and use suitable verb by @sashamelentyev in https://github.com/grpc-ecosystem/grpc-gateway/pull/2991
- runtime pkg cleanup by @sashamelentyev in https://github.com/grpc-ecosystem/grpc-gateway/pull/2993
- mux: fix path components mutation by @jonathaningram in https://github.com/grpc-ecosystem/grpc-gateway/pull/3001
- fix: set consumes definition per operation by @stomy13 in https://github.com/grpc-ecosystem/grpc-gateway/pull/2995
- protoc gen oas v2 cleanup by @sashamelentyev in https://github.com/grpc-ecosystem/grpc-gateway/pull/2996
- Use ReplaceAll instead of Replace with -1 pos by @sashamelentyev in https://github.com/grpc-ecosystem/grpc-gateway/pull/3003
- Errors cleanup by @sashamelentyev in https://github.com/grpc-ecosystem/grpc-gateway/pull/3004
- Cleanup by @sashamelentyev in https://github.com/grpc-ecosystem/grpc-gateway/pull/3012
- Support disabling default response rendering by @krak3n in https://github.com/grpc-ecosystem/grpc-gateway/pull/3006
- Support request header parameters by @krak3n in https://github.com/grpc-ecosystem/grpc-gateway/pull/3010
New Contributors
- @asraa made their first contribution in https://github.com/grpc-ecosystem/grpc-gateway/pull/2987
- @sashamelentyev made their first contribution in https://github.com/grpc-ecosystem/grpc-gateway/pull/2991
- @stomy13 made their first contribution in https://github.com/grpc-ecosystem/grpc-gateway/pull/2995
- @krak3n made their first contribution in https://github.com/grpc-ecosystem/grpc-gateway/pull/3006
Full Changelog: https://github.com/grpc-ecosystem/grpc-gateway/compare/v2.13.0...v2.14.0
下载链接
- grpc-gateway_2.14.0_checksums.txt
- multiple.intoto.jsonl
- protoc-gen-grpc-gateway-v2.14.0-darwin-arm64
- protoc-gen-grpc-gateway-v2.14.0-darwin-x86_64
- protoc-gen-grpc-gateway-v2.14.0-linux-arm64
- protoc-gen-grpc-gateway-v2.14.0-linux-x86_64
- protoc-gen-grpc-gateway-v2.14.0-windows-arm64.exe
- protoc-gen-grpc-gateway-v2.14.0-windows-x86_64.exe
- protoc-gen-openapiv2-v2.14.0-darwin-arm64
- protoc-gen-openapiv2-v2.14.0-darwin-x86_64
- protoc-gen-openapiv2-v2.14.0-linux-arm64
- protoc-gen-openapiv2-v2.14.0-linux-x86_64
- protoc-gen-openapiv2-v2.14.0-windows-arm64.exe
- protoc-gen-openapiv2-v2.14.0-windows-x86_64.exe