I am trying to create some API docs programmatically, I have this:
type APIDoc struct {
Route string
ResolutionValue struct {
v string
}
}
and then I tried doing this:
json.NewEncoder(w).Encode(APIDoc.ResolutionValue{"foo"})
but it says that
APIDoc.ResolutionValue undefined (type APIDoc has no method ResolutionValue)
so I resorted to doing this:
type ResolutionValue struct {
v string
}
type APIDoc struct {
Route string
ResolutionValue ResolutionValue
}
and then doing:
json.NewEncoder(w).Encode(ResolutionValue{"foo"})
kinda lame tho, is there a way to ensure integrity somehow?