You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swagger operation is unable to find definitions for models defined in another package when generating spec. I am getting "$refs must reference a valid location in the document " error when opening the generated yaml using swagger editor.
How to annotate and generate spec in this case?
Filemodel/user.go:
package model
typeUserstruct {
IDstring`json:"id"`
}
// User response payload// swagger:response UsertypeswaggUserInfostruct {
// in:bodyBody model.User
}
Filedocs/docs.go:
packagedocsimport"xxx/model"// swagger:operation GET /user queryUser// ---// responses:// '200':// schema:// "$ref": "#/definitions/User"
Environment
swagger version: v0.21.0
go version: go1.12.12
OS: RHEL
The text was updated successfully, but these errors were encountered:
Swagger operation is unable to find definitions for models defined in another package when generating spec. I am getting "$refs must reference a valid location in the document " error when opening the generated yaml using swagger editor.
How to annotate and generate spec in this case?
Environment
swagger version: v0.21.0
go version: go1.12.12
OS: RHEL
The text was updated successfully, but these errors were encountered: