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

When using the 'goctl api go' command, an error is reported: missing input #4189

Open
byp-yezi opened this issue Jun 13, 2024 · 0 comments
Open

Comments

@byp-yezi
Copy link

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

071681267b26a77de363d146faf642f

login.api

type (
	LoginRequest {
		Mobile   string `json:"mobile"`
		Password string `json:"password"`
	}
	LoginResponse {
		AccessToken  string `json:"accessToken"`
		AccessExpire int64  `json:"accessExpire"`
	}
)

register.api

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

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