Skip to content

goctl api go not support list/slices request #4769

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

Open
aoseryu opened this issue Apr 9, 2025 · 2 comments
Open

goctl api go not support list/slices request #4769

aoseryu opened this issue Apr 9, 2025 · 2 comments

Comments

@aoseryu
Copy link

aoseryu commented Apr 9, 2025

API的文件定义传参为List,但goctl 并不会实际生成。

@aoseryu
Copy link
Author

aoseryu commented Apr 9, 2025

API代码 :

demolist.api

syntax = "v1"

type Request {
	Name string `path:"name,options=you|me"`
}

type Response {
	Message string `json:"message"`
}

service demolist-api {
	@handler DemolistHandler
	get /from/:name ([]Request) returns ([]Response)
}

命令

goctl api go --api .\demolist.api --dir .

结果

可以看到请求并没有生成List

func DemolistHandler(svcCtx *svc.ServiceContext) http.HandlerFunc {
	return func(w http.ResponseWriter, r *http.Request) {
		var req types.Request
		if err := httpx.Parse(r, &req); err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
			return
		}

		l := logic.NewDemolistLogic(r.Context(), svcCtx)
		resp, err := l.Demolist(&req)
		if err != nil {
			httpx.ErrorCtx(r.Context(), w, err)
		} else {
			httpx.OkJsonCtx(r.Context(), w, resp)
		}
	}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant