Skip to content

Commit

Permalink
chore: maintain go mod and docs (#8)
Browse files Browse the repository at this point in the history
* chore: update go.mod and docs

* chore: update go.mod
  • Loading branch information
EZ4Jam1n authored Sep 25, 2024
1 parent 987932f commit 2af3194
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 14 deletions.
1 change: 1 addition & 0 deletions common/tpl/tpl.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,7 @@ import (
"strings"
"github.com/bytedance/gopkg/cloud/metainfo"
"github.com/cloudwego/dynamicgo/proto"
"github.com/cloudwego/hertz/pkg/app"
"github.com/cloudwego/hertz/pkg/app/server"
"github.com/cloudwego/hertz/pkg/common/hlog"
Expand Down
4 changes: 1 addition & 3 deletions protoc-gen-http-swagger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ require (
github.com/cloudwego/hertz/cmd/hz v0.9.1
github.com/hertz-contrib/cors v0.1.0
github.com/hertz-contrib/swagger v0.1.0
github.com/hertz-contrib/swagger-generate v0.0.0
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5
github.com/swaggo/files v1.0.1
google.golang.org/genproto/googleapis/api v0.0.0-20240701130421-f6361c86f094
google.golang.org/protobuf v1.34.2
Expand Down Expand Up @@ -47,5 +47,3 @@ require (
golang.org/x/tools v0.11.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/hertz-contrib/swagger-generate => ../../swagger-generate
2 changes: 2 additions & 0 deletions protoc-gen-http-swagger/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ github.com/hertz-contrib/cors v0.1.0 h1:PQ5mATygSMzTlYtfyMyHjobYoJeHKe2Qt3tcAOgb
github.com/hertz-contrib/cors v0.1.0/go.mod h1:VPReoq+Rvu/lZOfpp5CcX3x4mpZUc3EpSXBcVDcbvOc=
github.com/hertz-contrib/swagger v0.1.0 h1:FlnMPRHuvAt/3pt3KCQRZ6RH1g/agma9SU70Op2Pb58=
github.com/hertz-contrib/swagger v0.1.0/go.mod h1:Bt5i+Nyo7bGmYbuEfMArx7raf1oK+nWVgYbEvhpICKE=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5 h1:3FwLROMErehzzEK5WIkFHj1SXN45AFoCVB9w9LWXg4s=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5/go.mod h1:yS1Lb7xyxzEr1YGYpZlfuoR3q+9uA5/ZOfwbmw9Tqe0=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
Expand Down
6 changes: 2 additions & 4 deletions protoc-gen-rpc-swagger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ go 1.18

require (
github.com/bytedance/gopkg v0.1.1
github.com/cloudwego/dynamicgo v0.2.9
github.com/cloudwego/hertz v0.9.3
github.com/cloudwego/hertz/cmd/hz v0.9.1
github.com/cloudwego/kitex v0.10.3
github.com/hertz-contrib/cors v0.1.0
github.com/hertz-contrib/swagger v0.1.0
github.com/hertz-contrib/swagger-generate v0.0.0
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5
github.com/swaggo/files v1.0.1
google.golang.org/genproto/googleapis/api v0.0.0-20240730163845-b1a4ccb954bf
google.golang.org/protobuf v1.34.2
Expand All @@ -23,7 +24,6 @@ require (
github.com/bytedance/sonic/loader v0.2.0 // indirect
github.com/cloudwego/base64x v0.1.4 // indirect
github.com/cloudwego/configmanager v0.2.2 // indirect
github.com/cloudwego/dynamicgo v0.2.9 // indirect
github.com/cloudwego/fastpb v0.0.4 // indirect
github.com/cloudwego/frugal v0.1.15 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
Expand Down Expand Up @@ -73,5 +73,3 @@ require (
)

replace github.com/apache/thrift v0.17.0 => github.com/apache/thrift v0.13.0

replace github.com/hertz-contrib/swagger-generate => ../../swagger-generate
2 changes: 2 additions & 0 deletions protoc-gen-rpc-swagger/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ github.com/hertz-contrib/cors v0.1.0 h1:PQ5mATygSMzTlYtfyMyHjobYoJeHKe2Qt3tcAOgb
github.com/hertz-contrib/cors v0.1.0/go.mod h1:VPReoq+Rvu/lZOfpp5CcX3x4mpZUc3EpSXBcVDcbvOc=
github.com/hertz-contrib/swagger v0.1.0 h1:FlnMPRHuvAt/3pt3KCQRZ6RH1g/agma9SU70Op2Pb58=
github.com/hertz-contrib/swagger v0.1.0/go.mod h1:Bt5i+Nyo7bGmYbuEfMArx7raf1oK+nWVgYbEvhpICKE=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5 h1:3FwLROMErehzzEK5WIkFHj1SXN45AFoCVB9w9LWXg4s=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5/go.mod h1:yS1Lb7xyxzEr1YGYpZlfuoR3q+9uA5/ZOfwbmw9Tqe0=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI=
Expand Down
4 changes: 3 additions & 1 deletion thrift-gen-http-swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ HTTP Swagger document generation plugin for [cloudwego/cwgo](https://github.com/
1. Interface request fields need to be associated with a certain type of HTTP parameter and parameter name using annotations. Fields without annotations will not be processed.
2. Generate the `parameters` and `requestBody` of the `operation` in Swagger according to the request `message` in the `method`.
3. If the HTTP request uses the `GET`, `HEAD`, or `DELETE` methods, the `api.body` annotation in the `request` definition is invalid, and only `api.query`, `api.path`, `api.cookie`, `api.header` are valid.
4. The RPC method request only supports `struct` and empty types.

#### Annotation Explanation

Expand All @@ -27,7 +28,8 @@ HTTP Swagger document generation plugin for [cloudwego/cwgo](https://github.com/
### Response Specification

1. Interface response fields need to be associated with a certain type of HTTP parameter and parameter name using annotations. Fields without annotations will not be processed.
2. Generate the `responses` of the `operation` in Swagger according to the response `message` in the `method`.
2. Generate the `responses` of the `operation` in Swagger according to the response `message` in the `method`.
3. The RPC method response only supports `struct` and empty types.

#### Annotation Explanation

Expand Down
2 changes: 2 additions & 0 deletions thrift-gen-http-swagger/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
1. 接口请求字段需要使用注解关联到 HTTP 的某类参数和参数名称, 没有注解的字段不做处理。
2. 根据 `method` 中的请求 `message` 生成 swagger 中 `operation``parameters``requestBody`
3. 如果 HTTP 请求是采用 `GET``HEAD``DELETE` 方式的,那么 `request` 定义中出现的 `api.body` 注解无效,只有`api.query`, `api.path`, `api.cookie`, `api.header` 有效。
4. rpc 方法的请求只支持 `struct` 和空。

#### 注解说明

Expand All @@ -28,6 +29,7 @@

1. 接口响应字段需要使用注解关联到 HTTP 的某类参数和参数名称, 没有注解的字段不做处理。
2. 根据 `method` 中的响应 `message` 生成 swagger 中 `operation``responses`
3. rpc 方法的响应只支持 `struct` 和空。

#### 注解说明

Expand Down
4 changes: 1 addition & 3 deletions thrift-gen-http-swagger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ require (
github.com/cloudwego/thriftgo v0.3.15
github.com/hertz-contrib/cors v0.1.0
github.com/hertz-contrib/swagger v0.1.0
github.com/hertz-contrib/swagger-generate v0.0.0
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5
github.com/swaggo/files v1.0.1
)

replace github.com/hertz-contrib/swagger-generate => ../../swagger-generate
2 changes: 2 additions & 0 deletions thrift-gen-http-swagger/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ github.com/hertz-contrib/cors v0.1.0 h1:PQ5mATygSMzTlYtfyMyHjobYoJeHKe2Qt3tcAOgb
github.com/hertz-contrib/cors v0.1.0/go.mod h1:VPReoq+Rvu/lZOfpp5CcX3x4mpZUc3EpSXBcVDcbvOc=
github.com/hertz-contrib/swagger v0.1.0 h1:FlnMPRHuvAt/3pt3KCQRZ6RH1g/agma9SU70Op2Pb58=
github.com/hertz-contrib/swagger v0.1.0/go.mod h1:Bt5i+Nyo7bGmYbuEfMArx7raf1oK+nWVgYbEvhpICKE=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5 h1:3FwLROMErehzzEK5WIkFHj1SXN45AFoCVB9w9LWXg4s=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5/go.mod h1:yS1Lb7xyxzEr1YGYpZlfuoR3q+9uA5/ZOfwbmw9Tqe0=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jhump/gopoet v0.0.0-20190322174617-17282ff210b3/go.mod h1:me9yfT6IJSlOL3FCfrg+L6yzUEZ+5jW6WHt4Sk+UPUI=
Expand Down
1 change: 1 addition & 0 deletions thrift-gen-rpc-swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ http://127.0.0.1:8888/swagger/index.html
2. Swagger documentation can be supplemented with annotations such as `openapi.operation`, `openapi.property`, `openapi.schema`, `api.base_domain`, and `api.baseurl`.
3. To use annotations like `openapi.operation`, `openapi.property`, `openapi.schema`, and `openapi.document`, you need to import `openapi.thrift`.
4. Custom HTTP services are supported, and custom parts will not be overwritten during updates.
5. The RPC method request and response only support `struct` and empty types.

### Metadata Transmission
1. Metadata transmission is supported. By default, the plugin generates a `ttheader` query parameter for each method to transmit metadata, which should be in JSON format, e.g., `{"p_k":"p_v","k":"v"}`.
Expand Down
1 change: 1 addition & 0 deletions thrift-gen-rpc-swagger/README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ http://127.0.0.1:8888/swagger/index.html
2. 可通过注解来补充 swagger 文档的信息,如 `openapi.operation`, `openapi.property`, `openapi.schema`, `api.base_domain`, `api.baseurl`
3. 如需使用`openapi.operation`, `openapi.property`, `openapi.schema`, `openpai.document` 注解,需引用 openapi.thrift。
4. 支持自定义 http 服务,自定义部分更新时不会被覆盖。
5. rpc 方法的请求和响应只支持`struct`和空类型。

### 元信息传递
1. 支持元信息传递, 插件默认为每个方法生成一个`ttheader`的查询参数, 用于传递元信息, 格式需满足 json 格式, 如{"p_k":"p_v","k":"v"}。
Expand Down
4 changes: 1 addition & 3 deletions thrift-gen-rpc-swagger/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ require (
github.com/cloudwego/thriftgo v0.3.15
github.com/hertz-contrib/cors v0.1.0
github.com/hertz-contrib/swagger v0.1.0
github.com/hertz-contrib/swagger-generate v0.0.0
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5
github.com/swaggo/files v1.0.1
)

replace github.com/hertz-contrib/swagger-generate => ../../swagger-generate
2 changes: 2 additions & 0 deletions thrift-gen-rpc-swagger/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,8 @@ github.com/hertz-contrib/cors v0.1.0 h1:PQ5mATygSMzTlYtfyMyHjobYoJeHKe2Qt3tcAOgb
github.com/hertz-contrib/cors v0.1.0/go.mod h1:VPReoq+Rvu/lZOfpp5CcX3x4mpZUc3EpSXBcVDcbvOc=
github.com/hertz-contrib/swagger v0.1.0 h1:FlnMPRHuvAt/3pt3KCQRZ6RH1g/agma9SU70Op2Pb58=
github.com/hertz-contrib/swagger v0.1.0/go.mod h1:Bt5i+Nyo7bGmYbuEfMArx7raf1oK+nWVgYbEvhpICKE=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5 h1:3FwLROMErehzzEK5WIkFHj1SXN45AFoCVB9w9LWXg4s=
github.com/hertz-contrib/swagger-generate v0.0.0-20240921161005-987932fb30c5/go.mod h1:yS1Lb7xyxzEr1YGYpZlfuoR3q+9uA5/ZOfwbmw9Tqe0=
github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
github.com/iancoleman/strcase v0.2.0 h1:05I4QRnGpI0m37iZQRuskXh+w77mr6Z41lwQzuHLwW0=
github.com/iancoleman/strcase v0.2.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho=
Expand Down

0 comments on commit 2af3194

Please sign in to comment.