When I finished editing the API file and layered it according to the directory, I finally imported other API files into a main API file through API import.
type (
RegisterRequest {
Name string `json:"name"`
Gender int64 `json:"gender"`
Mobile string `json:"mobile"`
Password string `json:"password"`
}
RegisterResponse {
Id int64 `json:"id"`
Name string `json:"name"`
Gender int64 `json:"gender"`
Mobile string `json:"mobile"`
}
)
userinfo.api
type (
UserInfoResponse {
Id int64 `json:"id"`
Name string `json:"name"`
Gender int64 `json:"gender"`
Mobile string `json:"mobile"`
}
)
user.api
import (
"login/login.api"
"register/register.api"
"userinfo/useinfo.api"
)
@server (
prefix: /user/v1
)
service user-api {
@handler Login
post /api/login (LoginRequest) returns (LoginResponse)
@handler Register
post /api/register (RegisterRequest) returns (RegisterResponse)
}
@server (
prefix: /user/v1
jwt: Auth
)
service user-api {
@handler UserInfo
post /api/userinfo returns (UserInfoResponse)
}
I tried using 'goctl API validate' to check the API file, but still only 'missing input' reported an error
Finally i found in ' user.api ', and in the import, it should have been written as "userinfo/useinfo. apis" instead of "userinfo/useinfo. apis", missing the word "r"
Personal hope: I hope the 'go zero' team can help improve the 'goctl API validate' command, provide a prompt, or highlight the errors in red when using the vscode goctl plugin or goland goctl plugin
When I finished editing the API file and layered it according to the directory, I finally imported other API files into a main API file through API import.
Here is my directory structure
login.api
register.api
userinfo.api
user.api
I tried using 'goctl API validate' to check the API file, but still only 'missing input' reported an error
Finally i found in ' user.api ', and in the import, it should have been written as "userinfo/useinfo. apis" instead of "userinfo/useinfo. apis", missing the word "r"
Personal hope: I hope the 'go zero' team can help improve the 'goctl API validate' command, provide a prompt, or highlight the errors in red when using the vscode goctl plugin or goland goctl plugin