a-h / generate

Generates Go (golang) Structs from JSON schema.
MIT License
444 stars 137 forks source link

feature: convert `description` to comment? #58

Open evaneus opened 5 years ago

evaneus commented 5 years ago

Our schemas use description and examples to provide info about the properties. Would be great if these can be converted to comments in the structs to developers can see these notes in their IDE.

ghost commented 5 years ago

I was wondering the same. Then I've found out that draft 7 already has this: https://json-schema.org/draft-07/json-schema-core.html#rfc.section.9

$comments seems to be dedicated for notes to schema maintainers(coders as well??), as opposed to "description" which is suitable for display to end users.

It would be useful to add custom tags to struct properties. In my case i was looking for a solution to add gorm tags :)