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
No properties generated in json file for swagger:response #1161
Comments
The properties in the body struct need to be exported otherwise it can't generate json for it or read it in from json |
Sorry but i am not clear what do you mean by |
Their names need to be capitalized: package main
// A ValidationError is an error that is used when the required input fails validation.
// swagger:response validationError
type ValidationError struct {
// The error message
// in: body
Body struct {
// The validation message
//
// Required: true
Message string
// An optional field name to which this validation applies
FieldName string
}
} |
But with exporting properties(capitalizing) and running |
you can put the struct in a package that isn't main and it should start to work |
So here is my test.go
And validation.go
and still json generated is
Sorry but i just want one basic example to get working so that i work with other files |
Can i get some help with this? |
@casualjim I was able to generate correct json file. Thanks for your help :) |
How did you solve this? My |
+1 |
I had the same problem when using go via homebrew. What solved it for me was to install go from the go webside https://go.dev/doc/install and unset
|
Problem statement
swagger:response
annotation is not generatingproperties
in json file.I am using same example as shown in https://github.com/go-swagger/go-swagger/blob/master/docs/generate/spec/response.md
I am not sure what is missing?
similar issue is faced when using
swagger:parmeters
exampleSteps to reproduce
here is code in test.go file
execute
swagger generate spec -o ./swagger.json
commandswagger.json generated is
Environment
swagger version: 2.0
go version: 1.8.3
OS: mac
The text was updated successfully, but these errors were encountered: