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

能否允许在返回结构外 再包一层 #82

Open
foundVanting opened this issue Aug 22, 2023 · 0 comments
Open

能否允许在返回结构外 再包一层 #82

foundVanting opened this issue Aug 22, 2023 · 0 comments

Comments

@foundVanting
Copy link

比如我的返回方法 UserResponse,生成的doc,返回结构就和UserResponse一样。但实际一般都会再包一层, code,message等
导致apifox 等就会告诉你返回结构和实际不一致。

service main-api {
    @doc "获取 user info"
    @handler Info
    get / returns (UserResponse)
}
type UserResponse {
    ID      int    `json:"id"`
    Name    string `json:"name"`
    Phone   string `json:"phone"`
    Account string `json:"account"`
}
{
    "code": 200,
    "msg": "Success",
    "data": {
        "id": 1,
        "name": "Mary Corkery",
        "phone": "9525913637",
        "account": "[email protected]"
    }
}
@foundVanting foundVanting changed the title 能否允许在外边包一层 能否允许在返回结构外 再包一层 Aug 22, 2023
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