OpenZeppelin / solidity-docgen

Documentation generator for Solidity projects
MIT License
451 stars 118 forks source link

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

Open heueristik opened 1 year ago

heueristik commented 1 year ago

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.

frangio commented 1 year ago

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.

Whytecrowe commented 1 year ago

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.

frangio commented 1 year ago

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.

BeamNawapat commented 11 months ago

I believe this feature should be implemented.

0xneves commented 11 months ago

I believe this feature should be implemented.

Came looking for this, would be a perfect addition.