solidity-docgen icon indicating copy to clipboard operation
solidity-docgen copied to clipboard

NatSpec @notice, @param and @dev for enums and structs

Open heueristik opened this issue 2 years ago • 5 comments

It would be great if NatSpec @notice, @param and @dev comments on structs and enums would be available in the documentation.

For example, having

/// @notice Text.
/// @param a Text 1.
/// @param b Text 2.
struct ProposalParameters {
    bool a;
    uint256 b;
}

and documenting it with

{{natspec.notice}}

{{#if natspec.params}}
  | Member | Type | Description |
  |:------ | ---- | ----------- |
  {{#each params}}
    | {{name}} | {{type}} | {{natspec}} |
  {{/each}}
{{/if}}

I am aware of https://github.com/OpenZeppelin/solidity-docgen/issues/413, but still unsure if this is possible by now or not because of insufficiencies of the solidity compiler.

heueristik avatar Feb 08 '23 11:02 heueristik

This is a problem with the Solidity compiler. I might be able to work around it with some effort but it really needs to be fixed upstream. See https://github.com/ethereum/solidity/issues/12295.

frangio avatar Feb 09 '23 17:02 frangio

Would really love to have this feature! Any updates on this? Data for struct definitions is available and can be formatted into an md file. Strange there's still no solution for this.

Whytecrowe avatar Jul 11 '23 23:07 Whytecrowe

This should work out of the box already for structs and enums as long as Solidity >=0.8.20 is used.

@param is still not supported. Solidity continues to be the limitation for that.

frangio avatar Jul 28 '23 22:07 frangio

I believe this feature should be implemented.

BeamNawapat avatar Nov 24 '23 18:11 BeamNawapat

I believe this feature should be implemented.

Came looking for this, would be a perfect addition.

0xneves avatar Dec 15 '23 05:12 0xneves