Skip to content

Libdoc: Include usage information to data types in spec files #4218

Closed

Description

@pekkaklarck

Libdoc spec files contain information about types used as type hints. Earlier there was only information about enumerations and typed dicts, but RF 5.0 has already added information about custom converters (#4088) and the plan is to add also info about standard converters (#4160). This is handy, but using the information is not so convenient because the information where these data types are actually used isn't directly available.

Libdoc's HTML output contains somewhat complicated Javascript code to map data types to arguments. Because it does mapping using type names, it doesn't work correctly with extended types. Robot obviously itself knows what arguments map to which types and Libdoc could write this information to spec files. It would both make the information easily available and make sure that the information is correct.

Activity

  1. added this to the v5.0 milestone on Feb 6, 2022
  2. pekkaklarck commented on Feb 6, 2022

    @pekkaklarck
    MemberAuthor

    Usage information will be added only to types in the new types list (see #4160 (comment)), not to types in the old and deprecated dataTypes. Added information will contain names of the keywords and their arguments using the type. Including the argument information is required to properly support extended types. In practice JSON specs will look like this:

    {
      "types": [{
        "type": "Custom",
        "name": "date",
        "doc": "<p>Example</p>",
        "usages": [
          {"kw": "Keyword Name",
           "args": ["arg_name"]},
          {"kw": "Keyworrd 2",
           "args": ["arg1", "arg2"]}
        ]
      }]
    }

    Spec schemas will naturally be updated.

  3. pekkaklarck commented on Feb 9, 2022

    @pekkaklarck
    MemberAuthor

    The original implementation didn't work well if an argument had multiple types because type docs were only linked to arguments, not to their types. This was fixed by linking to argument types themselves to type docs. In XML this info is stored like <type typedoc='Example'>ArgType</type> and in JSON each argument has a separate mapping for like {'ArgType: 'Example'}. After that there was no need to store argument information with type docs, they only really need to know keywords where types are used.

    Another change in the above commits was that type docs are stored under typedocs, not types, both in XML and JSON specs.

    After these changes the earlier example now looks like this:

    {
      "typedocs": [{
        "type": "Custom",
        "name": "date",
        "doc": "<p>Example</p>",
        "usages": ["Keyword Name", "Keyword 2"]
      }]
    }
  4. added a commit that references this issue on Jul 15, 2025
    44e6e7b
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

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions