go-swaggerLite icon indicating copy to clipboard operation
go-swaggerLite copied to clipboard

Can not find definition of unnamed model.

Open jackman0 opened this issue 8 years ago • 3 comments

When attempting to use go-swaggerLite, I eventually come up against this 'cannot find definition' error message. It appears to be an anonymous struct literal. I can't seem to find anything in my code that has this kind of signature. Has anyone run into this before?

jackman@z420:~$ go-swaggerLite -apiPackage="foo/bar" -mainApiFile="foo/bar/main.go" -packageExclusionList="golang_org/x/net/lex/httplex,golang_org/x/net/http2/hpack,golang_org/x/net/route"
2016/09/21 15:54:29 Can not find definition of &{8122 0xc4200e3e60 false} model. Current package foo/bar

BTW, the 'support-vendor-dir' branch was very helpful to me, as you can see above.

jackman0 avatar Sep 21 '16 21:09 jackman0

It appears that I've narrowed down the scope of this problem.

Please see this project:

https://github.com/jackmanlabs/swagger-test

This project contains to very simple web APIs that demonstrate that the swagger tool fails to handle nested structs in response types. Is there a work-around for this?

Thank you.

jackman0 avatar Sep 22 '16 21:09 jackman0

@jackmanlabs how were you able to use the -packageExclusionList flag? That flag doesn't exist for me.

flag provided but not defined: -packageExclusionList
Usage of ../../go-swaggerLite:
  -apiPackage string
        The package that implements the API controllers, relative to $GOPATH/src
  -basePath string
        Web service base path
  -format string
        Output format type for the generated files: go|markdown (default "go")
  -mainApiFile string
        The file that contains the general API annotations, relative to $GOPATH/src
  -output string
        The opitonal name of the output file to be generated (default "generatedSwaggerSpec.go")
  -package string
        The opitonal package name of the output file to be generated (default "main")

jackic23 avatar Oct 11 '16 15:10 jackic23

@jackic23 I used the 'support-vendor-dir' branch.

jackman0 avatar Oct 11 '16 16:10 jackman0