Skip to content

Added NatSpec support for enum value definitions #9545

Open
@lilyanB

Description

@lilyanB

Component

Forge

Describe the feature you would like

Currently, solidity doesn't support @param for enums (according to the natspec format). So when generating the documentation with forge doc, there is no way to document each enum variant.
The suggestion is to define a @custom:variant item to describe each enum variant.
Foundry already does something similar with unnamed function params ( see here ).

Additional context

Example of result:

/**
 * @dev Enum representing the status of a transaction
* @custom:variant Pending the transaction is pending
* @custom:variant Done the transaction is done
* @custom:variant Revert the transaction is revert
*/
enum Transaction {
    Pending,
    Done,
    Revert
}

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Ready For Review

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions