Skip to content

Libdoc: Support separate type documentation for arguments and return values #5566

Description

@pekkaklarck

Libdoc shows documentation for recognized types used as arguments and, since RF 7.0 (#3017), as return types. There are four kind of recognized types:

  • Standard types (str, list, Path, ...)
  • Enums
  • TypedDicts
  • Custom types

With standard types the shown documentation is part of the Libdoc implementation and with the other types the docs come from the types themselves and are written by library developers.

This system works well in general, but if the same type is used with arguments and also as a return type, writing good documentation that covers both usages can be problematic. Argument type documentation should in general specify what arguments are allowed, while the return type documentation should explain how the return value can be used, what kind of attributes custom objects have, and so on.

A solution to this problem is making it possible to have separate documentation for argument types and return types. This is what getting it done requires in high level:

  1. Design how to store separate argument and return type docs in Libdoc spec files.
  2. Update Libdoc HTML UI accordingly.
  3. Write return type docs for standard types.
  4. Design how other types can specify return type docs. Currently docs are got from class or function docstrings, and we could support some marker there that would separate different docs. Alternatively classes/functions could have a custom attribute like type_doc that could be a two-tuple with argument and return type docs separately.

Activity

  1. added this to the v7.5 milestone on Nov 28, 2025
  2. pekkaklarck commented on Nov 28, 2025

    @pekkaklarck
    MemberAuthor

    The current standard type docs have been written with an idea that they are only used with arguments. They were so confusing as return type docs that RF 7.4 disabled showing them in Libdoc HTML UI (#5565). That change needs to be reverted as part of this issue when it is possible to have separate docs for return types.

  3. changed the title [-]Libdoc: Support separate argument and return type documentations[/-] [+]Libdoc: Support separate argument and return type documentation[/+] on Nov 29, 2025
  4. changed the title [-]Libdoc: Support separate argument and return type documentation[/-] [+]Libdoc: Support separate type documentation for arguments and return values[/+] on Mar 23, 2026
  5. modified the milestones: v7.5, v7.6 on Jul 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions