Closed brock-weaver-roostify closed 2 years ago
added strict type check, my bad
What is this, exactly? What is the motivation, where is the issue discussed first, etc?
This was an enhancement I needed for my purposes -- I had an example json payload and I wanted the values in that example to be emitted in the generated model definition. The "example" annotation alongside the "json" annotation is picked up by https://github.com/swaggo/gin-swagger when generating Swagger documentation.
e.g. I had this:
{
"firstName":"Alice"
}
and I wanted this go model to be emitted:
type AutoGenerated struct {
FirstName `json:"firstName" example:"Alice"`
}
gin-swagger uses the "example" annotation there and will include it in the resulting swagger file it generates when running "swag init".
Oh I see, #101. (Somehow missed that.)
Seems to be a simple enough change. Thanks for the contribution.
Oh sorry -- I should have tagged #101 on that. My bad. And thank you for such a useful tool!
added test cases as well