Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade latest gozero version and fix parse range options #76

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
### 1. 编译goctl-swagger插件

```
GOPROXY=https://goproxy.cn/,direct go install github.com/zeromicro/goctl-swagger@latest
GOPROXY=https://goproxy.cn/,direct go install github.com/cdz620/goctl-swagger@latest
```

### 2. 配置环境
Expand Down
2 changes: 1 addition & 1 deletion action/action.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package action

import (
"github.com/cdz620/goctl-swagger/generate"
"github.com/urfave/cli/v2"
"github.com/zeromicro/go-zero/tools/goctl/plugin"
"github.com/zeromicro/goctl-swagger/generate"
)

func Generator(ctx *cli.Context) error {
Expand Down
7 changes: 5 additions & 2 deletions generate/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,10 @@ func renderStruct(member spec.Member) swaggerParameterObject {
ftype = tempKind.String()
format = "UNKNOWN"
}
sp := swaggerParameterObject{In: "query", Type: ftype, Format: format}
sp := swaggerParameterObject{
In: "query", Type: ftype, Format: format,
Schema: &swaggerSchemaObject{},
}

for _, tag := range member.Tags() {
sp.Name = tag.Name
Expand Down Expand Up @@ -540,7 +543,7 @@ func schemaOfField(member spec.Member) swaggerSchemaObject {
comment = strings.Replace(comment, "//", "", -1)

switch ft := kind; ft {
case reflect.Invalid: //[]Struct 也有可能是 Struct
case reflect.Invalid: // []Struct 也有可能是 Struct
// []Struct
// map[ArrayType:map[Star:map[StringExpr:UserSearchReq] StringExpr:*UserSearchReq] StringExpr:[]*UserSearchReq]
refTypeName := strings.Replace(member.Type.Name(), "[", "", 1)
Expand Down
65 changes: 59 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,12 +1,65 @@
module github.com/zeromicro/goctl-swagger
module github.com/cdz620/goctl-swagger

go 1.16
go 1.18

require (
github.com/grpc-ecosystem/grpc-gateway v1.16.0
github.com/spf13/cobra v1.5.0 // indirect
github.com/urfave/cli/v2 v2.3.0
github.com/zeromicro/go-zero v1.3.0
github.com/zeromicro/go-zero/tools/goctl v1.3.2
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
github.com/zeromicro/go-zero v1.5.2
github.com/zeromicro/go-zero/tools/goctl v1.5.2
golang.org/x/oauth2 v0.7.0
)

require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/fatih/color v1.15.0 // indirect
github.com/fatih/structtag v1.2.0 // indirect
github.com/felixge/fgprof v0.9.3 // indirect
github.com/ghodss/yaml v1.0.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/glog v1.1.0 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/google/pprof v0.0.0-20230510103437-eeec1cb781c3 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/logrusorgru/aurora v2.0.3+incompatible // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.18 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/openzipkin/zipkin-go v0.4.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
github.com/prometheus/client_golang v1.15.1 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.43.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/cobra v1.7.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/zeromicro/antlr v1.0.0 // indirect
go.opentelemetry.io/otel v1.15.1 // indirect
go.opentelemetry.io/otel/exporters/jaeger v1.15.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.15.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.15.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.15.1 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.15.1 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.15.1 // indirect
go.opentelemetry.io/otel/sdk v1.15.1 // indirect
go.opentelemetry.io/otel/trace v1.15.1 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/automaxprocs v1.5.2 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.55.0 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
Loading