go-zero
go-zero copied to clipboard
Type XxxReq generate error, type ApkGuestLoginReq, json property name not exist, member: OS
Describe the bug
goctl api ts
failed to generate ts file.
To Reproduce goctl api ts --api dock.api --caller request --webapi '@/services/request' --dir /your/dir
-
The code is
ApkGuestLoginReq { OS int32 `header:"x-os"` App int32 `header:"x-app"` Channel int32 `header:"x-ch,optional"` } ApkUserLoginResp {} @server( group: apk/user middleware: ApkSign prefix: /apk/users ) service big-api { @doc "游客登录接口" @handler GuestLogin post /guest/login (ApkGuestLoginReq) returns (ApkUserLoginResp) }
-
The error is
2022/08/07 15:23:00 Type ApkGuestLoginReq generate error, type ApkGuestLoginReq, json property name not exist, member: OS
Expected behavior generate ts file
Screenshots nil
Environments (please complete the following information):
- OS: MacOS
- github.com/zeromicro/go-zero v1.3.5
-
goctl version 1.3.9 darwin/arm64
More description Add any other context about the problem here.
显而易见,goctl 已经提示了需要 json tag
Obviously, goctl has prompted the need for json tag
the body without data and I just want to get data from header.
如果你不需要响应体,你可以写成这样:
If you not need to response, you can declare as follows:
post /guest/login (ApkGuestLoginReq)
我需要header,所有需要写一个Struct来接收,header的参数,但是我不需要Request Body的内容
Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑🤝🧑👫🧑🏿🤝🧑🏻👩🏾🤝👨🏿👬🏿
I need the header, all I need to write a Struct to receive, the parameters of the header, but I don't need the content of the Request Body
This issue is stale because it has been open for 30 days with no activity.