发布日期: 2022-11-15
版本号: v2.14.0

本次版本更新主要包含由@krak3n贡献的两项OpenAPIv2生成器新功能:一是新增禁用默认200 OK响应渲染的选项,适用于已自定义端点响应并修改返回码的场景;二是支持通过注解定义Swagger.json输出中的请求头参数,需配合应用层的自定义解析逻辑。此外,其他变更包括优化发布流程配置、清理代码库、修复路径组件异常及请求消费类型设置问题等,涉及@asraa、@sashamelentyev等多位贡献者的提交。此次版本还迎来了@asraa、@sashamelentyev、@stomy13和@krak3n四位新贡献者的首次参与。

更新内容 (中文)

新特性

此版本包含两个由 @krak3n 贡献的重要 OpenAPIv2 生成器新特性:

  1. 禁用 200 OK 响应渲染 的新选项。当您为端点定义自定义响应并修改转发响应编写器的返回码时,此功能非常有用。注意:此选项不会改变网关本身的行为。
  2. 定义头部参数 的新注解。该功能允许在 API 消息定义之外,额外指定需要渲染到 swagger.json 输出的头部参数。注意:此功能不会改变网关本身的行为,需与应用程序中的自定义头部解析配合使用。

变更内容

新贡献者

完整变更日志: 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:

  1. 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.
  2. 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

New Contributors

Full Changelog: https://github.com/grpc-ecosystem/grpc-gateway/compare/v2.13.0...v2.14.0

下载链接