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

Support anonymous field parsing #7

Closed
lpxxn opened this issue Dec 6, 2017 · 4 comments
Closed

Support anonymous field parsing #7

lpxxn opened this issue Dec 6, 2017 · 4 comments
Labels

Comments

@lpxxn
Copy link

lpxxn commented Dec 6, 2017

type RevValueBase struct {

	Status bool	`json:"Status"`

	Err int32	`json:"Err"`

	Error RevError 	`json:"Error"`

}
type RevValue struct {

	RevValueBase

	Data int	`json:"Data"`

}

when use composition return value, use swag init error

// @Success 200 {object} controllerparams.RevValue "ok"

panic: runtime error: index out of range

@easonlin404
Copy link
Member

easonlin404 commented Dec 11, 2017

@lpxxn Sorry for my late reply, swag doesn't support anonymous field parsing. I want to add this future sooner. 😢

@easonlin404 easonlin404 changed the title anonymous field error Support anonymous field struct parsing Dec 11, 2017
@easonlin404 easonlin404 changed the title Support anonymous field struct parsing Support anonymous field parsing Dec 11, 2017
@easonlin404
Copy link
Member

fixed swaggo/swag#40

@easonlin404
Copy link
Member

@lpxxn Please update your github.com/swaggo/swag to the latest version.

@javasgl
Copy link

javasgl commented Feb 9, 2018

type ApiResponse struct {
	Success int         `json:"success"`
	Error   error       `json:"error"`
	Data    interface{} `json:"data"`
}

if Model contains a filed with the type interface{}, swag init got the error:

Something goes wrong: &ast.InterfaceType{Interface:239, Methods:(*ast.FieldList)(0xc4203ca930), Incomplete:false}

In above code, Data was been defined as interface{}, it broken the swag init command.
@easonlin404

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

No branches or pull requests

3 participants