# How to document an enum?

**URL:** <https://discourse.julialang.org/t/how-to-document-an-enum/126329>\
**Category:** General Usage\
**Tags:** question\
**Created:** [February 26, 2025, 10:03am UTC](https://discourse.julialang.org/t/how-to-document-an-enum/126329 "2025-02-26T10:03:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [February 26, 2025, 10:03am UTC](https://discourse.julialang.org/t/how-to-document-an-enum/126329/1 "2025-02-26T10:03:13Z")

</div>

What is a good way to document an enum?

I currently do this:

```julia
"""
   Model `VSM` `LLT`

Enumeration of the implemented model types.

# Elements
- VSM: Vortex Step Method
- LLT: Lifting Line Theory
"""
@enum Model VSM LLT

```

Is there a better way?

---

<div class="post-metadata">

**Author:** ![jakobjpeters](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jakobjpeters/32/207797_2.png) [@jakobjpeters](https://discourse.julialang.org/u/jakobjpeters)\
**Post date:** [February 28, 2025, 1:37am UTC](https://discourse.julialang.org/t/how-to-document-an-enum/126329/2 "2025-02-28T01:37:13Z")

</div>

I do a primary docstring like you have, but also a short docstring for each variant so that `?VSM` tells me what it is

```julia
@doc """
   VSM::Model

Vortex Step Method.

See also [`Model`](@ref).
""" VSM

@doc """
   LLT::Model

Lifting Line Theory.

See also [`Model`](@ref).
""" LLT

```

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 21, 2025, 1:56pm UTC](https://discourse.julialang.org/t/how-to-document-an-enum/126329/3 "2025-04-21T13:56:22Z")

</div>

> [@jakobjpeters](#):
>
> ```julia
> @doc """
> VSM::Model
> 
> Vortex Step Method.
> 
> See also [`Model`](@ref).
> 
> ```

This is not yet working for me:

```julia
"""
    @enum ProfileLaw EXP=1 LOG=2 EXPLOG=3

Enumeration to describe the wind profile low that is used.
"""
@enum ProfileLaw begin
    EXP=1 
    LOG=2 
    EXPLOG=3 
    FAST_EXP=4 
    FAST_LOG=5 
    FAST_EXPLOG=6
end
@doc """
    EXP::ProfileLaw

Exponential wind profile.

See also [`ProfileLaw`](@ref).
"""

```

I get:

```julia
help?> EXP
search: EXP EXPLOG

  No documentation found for private symbol.

  EXP is of type ProfileLaw.

  Summary
  ≡≡≡≡≡≡≡

  primitive type ProfileLaw

  Supertype Hierarchy
  ≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡≡

  ProfileLaw <: Enum{Int32} <: Any

```

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![ufechner7](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ufechner7/32/51363_2.png) [@ufechner7](https://discourse.julialang.org/u/ufechner7)\
**Post date:** [April 21, 2025, 2:05pm UTC](https://discourse.julialang.org/t/how-to-document-an-enum/126329/4 "2025-04-21T14:05:28Z")

</div>

> [@ufechner7](#):
>
> ```julia
> @doc """
> EXP::ProfileLaw
> 
> Exponential wind profile.
> 
> See also [`ProfileLaw`](@ref).
> """
> 
> ```

Got it, this works:

```julia
"""
    @enum ProfileLaw EXP=1 LOG=2 EXPLOG=3

Enumeration to describe the wind profile low that is used.
""" ProfileLaw

@enum ProfileLaw begin 
    EXP=1 
    LOG=2 
    EXPLOG=3 
    FAST_EXP=4 
    FAST_LOG=5 
    FAST_EXPLOG=6
end

@doc """
    EXP::ProfileLaw

Exponential wind profile.

See also [`ProfileLaw`](@ref).
""" EXP

```
