-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
External x-go-type imports not resolved for arrays and references #1719
Comments
Does this means that the PR you delivered does not work? It is not clear to me. I think your examples are related specifically to models reused in the generation of the "operations" package. Line 211 in e13f855
|
Nevermind, I somehow replaced "alias" with "type" in my swagger spec. Sorry, too much digging for today. |
Ok, I found out what issue I had, I'll update it. |
It seems that my PRs fixed imports only for flat objects, don't know why. My knowledge about go-swagger generator code is probably too basic to fix it now. I hope somebody can help. Here is original commit which introduced x-go-type feature: I thought that ma PR #1705 allowing whole model definition hierarchy to build (removed return nil, nil from beginning |
as I said, there is a special provision with type resolver to use models in the operations package from the models package. This occurs when body or response use a schema which is already available, e.g. in the models package (default). |
I discovered that adding
before Lines 630 to 633 in e13f855
solves import problem also for |
I don't think the problem really lies with arrays, but more likely with arrays or maps of models |
Requalified as bug. Could reproduce. Will look into it. |
* fixes go-swagger#1719 * regenerated bindata with github.com/kevinburke/go-bindata v3.13.0 Signed-off-by: Frederic BIDON <fredbi@yahoo.com>
Problem statement
Ok, after few days of debugging I give up. Problem with imports using
x-go-type
still exists after my changes, is seems that it fixed only imports when flat object definition is used.File: get_user_obj_ref_responses.go - FAIL
With swagger 0.16.0 same result.
File: get_user_obj_flat_responses.go - CORRECT
With swagger 0.16.0 import MISSING
File: get_users_arr_ref_responses.go - FAIL
With swagger 0.16.0 same result.
File: get_users_arr_flat_responses.go - FAIL
With swagger 0.16.0 same result.
Swagger specification
Steps to reproduce
swagger generate server -f swagger.yml
Environment
swagger version: master
go version: 1.11
OS: Ubuntu 18.04
The text was updated successfully, but these errors were encountered: