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

v1.6.8 External package is not going to be resolved #809

Closed
Rayer opened this issue Oct 16, 2020 · 2 comments
Closed

v1.6.8 External package is not going to be resolved #809

Rayer opened this issue Oct 16, 2020 · 2 comments

Comments

@Rayer
Copy link

Rayer commented Oct 16, 2020

Describe the bug
After upgrade v1.6.8, external package struct can't be resolved correctly, and product error.

To Reproduce
Here is an sample code


// IssueApiKey godoc
// @Summary Issue an API Key
// @Description Issue an API Key to user, this endpoint requires privileges
// @Tags ApiKey
// @Accept json
// @Produce json
// @param input body IssueApiKeyPayload true "Input info"
// @Param apiKey query string true "API Key(Privileged)"
// @Security ApiKeyAuth
// @Success 200 {object} IssueApiKeyResponse
// @Failure 400 {object} problems.DefaultProblem
// @Router /apiKey [post]
func (c *Controller) IssueApiKey(ctx *gin.Context) {
	input := &IssueApiKeyPayload{}
	err := ctx.BindJSON(input)
	if err != nil {
		err400 := problems.NewDetailedProblem(http.StatusBadRequest, err.Error())
		ctx.JSON(400, err400)
		return
	}
	key, err := c.ApiKeyService.IssueApiKey(input.Application, input.UseInHeader, input.UseInQueryParam, "auto", false)
	if err != nil {
		err500 := problems.NewDetailedProblem(http.StatusInternalServerError, err.Error())
		ctx.JSON(500, err500)
		return
	}
	ctx.JSON(http.StatusOK, IssueApiKeyResponse{
		Key: key,
	})
}

in v1.6.7, it works fine. In v1.6.8, it products error

2020/10/16 15:19:43 Generate swagger docs....
2020/10/16 15:19:43 Generate general API Info, search dir:./
2020/10/16 15:19:44 Generating main.IssueApiKeyPayload
2020/10/16 15:19:44 Generating main.IssueApiKeyResponse
2020/10/16 15:19:44 ParseComment error in file apikey_controller.go :cannot find type definition: problems.DefaultProblem
server_main.go:26: running "/Users/killercat/go/bin/swag": exit status 1

problems.DefaultProblem is defined in external library, for this case, it's https://github.com/mschneider82/problem

Expected behavior
It should able to generate swagger.json in this case in v1.6.7. It's broken in v1.6.8

Screenshots
image
image

Your swag version
e.g. 1.6.8

Your go version
e.g. 1.15.1

Desktop (please complete the following information):

  • OS: macOS 10.15.7
  • Browser: Safari

Additional context
None

@Rayer
Copy link
Author

Rayer commented Oct 16, 2020

Properly duplicated with #802

@Rayer
Copy link
Author

Rayer commented Oct 16, 2020

It seems author have explained in #808, close this ticket.

@Rayer Rayer closed this as completed Oct 16, 2020
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