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
unsupported type "invalid type" error when using Linux binary #2379
Comments
To investigate this it would be great to have a more complete reproduction case. |
I apologize for leaving out some details. I'm running this in a ubuntu:20.04 docker container and the go version is |
Any updates here? I am also facing the same issue with the alpine image.
my go version is 1.12.5 |
@ShriprasadM could you please include some valid go source to be able to reproduce the case? |
Somehow, for this sample, I was able to reproduce it on macOS. Please correct me, if I am missing anything
|
how does that project compile? The project in sample isn't valid go the imports can't work |
I have not focused on project compilation it may not work for sample.zip. I was preferring to look for catching the swagger command error |
does your actual application compile? |
Yes. it compiles |
if you run with the env var DEBUG=1, does it tell you which type is wrong? Can you share the type? it would be very helpful to see both the content the file that has ss.SyncStatus and the import definition used in the file that has: // SyncStatusResult represents the status of a request
//
// swagger:model SyncStatusResult
type SyncStatusResult struct {
// Enum: queued,success,failure
SyncStatus ss.SyncStatus `json:"sync_status"`
Status string `json:"status"`
} as well as how their paths are related on the filesystem? (one is a module or a sub/sibling/parent/unrelated) |
This codebase is shared by @ahobbs-cb . Let me try to share my working version of code |
With debug=1 and and swagger generate spec . -> I can see following
I have updated #2379 (comment) sample.zip. if you run swagger command it will give you "invalid type" output. The project is not compiled because |
I can see, if the package is no under the Still : In My actual project, it works on MacOS and fails on Linux |
I am using linux (go1.15.3). From your screenshot above, the generate spec fails on Mac AND linux with the same error. My hunch on how this works is that to make generate spec work, the code needs to build correctly. On my environment, your script fails at This works:
and so does the spec generation:
This fails:
This works:
|
This is what I have observed |
If you execute this step, go run will work |
When can we expect the fix for Linux build? |
@fredbi any updates on this |
@ShriprasadM as I've shown above, running the generate command with the proper environment set up just worked. I failed to see any evidence of how this works differently on macOS (the screenshots above essentially show the same failure). There might be some uncovered edge case in the way we resolve GOPATH with multiple values. However, this can be worked around rather easily. If you feel strongly about it, you can contribute a PR. What we do for packages identification just relies on the standard library here go-swagger/codescan/application.go Line 14 in c36f768
|
Problem statement
I'm getting a
unsupported type "invalid type"
when generating a spec using the v0.25.0 linux binary. I don't get this error when using the darwin binary. It's also fixed if I remove any references to a schema outside of the package.Swagger specification
Steps to reproduce
swagger.sh generate spec -m -o swagger.json
with above code and linux binary and getunsupported type "invalid type"
errorEnvironment
swagger version: v0.25.0
go version: 1.14.4
OS: linux
The text was updated successfully, but these errors were encountered: