How to document struct fields programmatically

Is there any way to add documentation to fields in my struct programmatically (after defining the struct)?

"MyStruct doc"
struct MyStruct
    "MyStruct.a doc"
    a::Float64
end
# This has docs for ?MyStruct.a
"MyStruct doc"
struct MyStruct
    a::Float64
end
@doc "MyStruct.a doc" MyStruct.a # Does not work

Thanks!

1 Like