# How to document struct fields programmatically

**URL:** <https://discourse.julialang.org/t/how-to-document-struct-fields-programmatically/90042>\
**Category:** General Usage\
**Created:** [November 10, 2022, 10:21am UTC](https://discourse.julialang.org/t/how-to-document-struct-fields-programmatically/90042 "2022-11-10T10:21:11Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nandoconde](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nandoconde/32/19497_2.png) [@nandoconde](https://discourse.julialang.org/u/nandoconde)\
**Post date:** [November 10, 2022, 10:21am UTC](https://discourse.julialang.org/t/how-to-document-struct-fields-programmatically/90042/1 "2022-11-10T10:21:12Z")

</div>

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

```julia
"MyStruct doc"
struct MyStruct
    "MyStruct.a doc"
    a::Float64
end
# This has docs for ?MyStruct.a

```

```julia
"MyStruct doc"
struct MyStruct
    a::Float64
end
@doc "MyStruct.a doc" MyStruct.a # Does not work

```

Thanks!
