0
Help us understand the problem. What are the problem?

posted at

go-swaggerで`ParseComment error in file /go/src/controller/xxx.go :cannot find type definition: json.RawMessage`

経緯

GORMのmodelにてjson.RawMessageを定義してると、go-swaggerのswag initでドキュメント生成に失敗する

/go/src # swag init
2022/04/28 07:10:29 Generate swagger docs....
2022/04/28 07:10:29 Generate general API Info, search dir:./
2022/04/28 07:10:29 Generating xxxxxxxxx
2022/04/28 07:10:29 Generating xxxxxxxxx
2022/04/28 07:10:29 Generating xxxxxxxxx
2022/04/28 07:10:29 Generating xxxxxxxxx
2022/04/28 07:10:29 ParseComment error in file /go/src/controller/xxx.go :cannot find type definition: json.RawMessage

この2つのオプションを追加すると解消した

swag init --parseDependency --parseInternal

Register as a new user and use Qiita more conveniently

  1. You can follow users and tags
  2. you can stock useful information
  3. You can make editorial suggestions for articles
What you can do with signing up
0
Help us understand the problem. What are the problem?