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

gf gen ctr cannot recognize type struct group definition #2827

Closed
alaywn opened this issue Aug 1, 2023 · 1 comment · Fixed by #3115
Closed

gf gen ctr cannot recognize type struct group definition #2827

alaywn opened this issue Aug 1, 2023 · 1 comment · Fixed by #3115
Labels
enhancement help wanted planned This issue/proposal is planned into our next steps.

Comments

@alaywn
Copy link
Contributor

alaywn commented Aug 1, 2023

1. What version of Go and system type/arch are you using?

go version go1.20.6 darwin/arm64

2. What version of GoFrame are you using?

GoFrame CLI Tool v2.5.1, https://goframe.org
GoFrame Version: cannot find go.mod
CLI Installed At: /opt/homebrew/bin/gf
CLI Built Detail:
  Go Version:  go1.20.4
  GF Version:  v2.5.1
  Git Commit:  2023-07-26 21:27:58 e0e00434cc87d6edf64fc3df40ce7d3f40758794
  Build Time:  2023-07-26 21:32:56

3. Can this issue be re-produced with the latest release?

YES

4. What did you do?

按照gf gen ctrl 使用规范执行后,发现一直生成不了文件,后来发现是因为这样定义了api结构体:

type (
	UserCreateReq struct {
		g.Meta `path:"/User/Create" method:"post" summary:"UserCreateReq" tags:"User"`
		Master *model.UserInput `json:"master"`
	}
	UserCreateRes struct {
		Master *model.UserOutput `json:"master"`
	}
)

如果改为如下定义方式,则可以生成文件:

type UserCreateReq struct {
	g.Meta `path:"/User/Create" method:"post" summary:"UserCreateReq" tags:"User"`
	Master *model.UserInput `json:"master"`
}
type UserCreateRes struct {
	Master *model.UserOutput `json:"master"`
}

5. What did you expect to see?

希望能支持两种结构体定义方式

6. What did you see instead?

@Issues-translate-bot Issues-translate-bot changed the title gf gen ctr无法识别type struct组定义 gf gen ctr cannot recognize type struct group definition Aug 1, 2023
@gqcn gqcn added enhancement help wanted planned This issue/proposal is planned into our next steps. labels Oct 7, 2023
@github-actions
Copy link

github-actions bot commented Oct 7, 2023

Hello @alaywn. We like your proposal/feedback and would appreciate a contribution via a Pull Request by you or another community member. We thank you in advance for your contribution and are looking forward to reviewing it!
你好 @alaywn。我们喜欢您的提案/反馈,并希望您或其他社区成员通过拉取请求做出贡献。我们提前感谢您的贡献,并期待对其进行审查。

@oldme-git oldme-git linked a pull request Feb 17, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement help wanted planned This issue/proposal is planned into our next steps.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants