Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libdoc: Include automatic argument conversion info #4160

Closed
pekkaklarck opened this issue Dec 3, 2021 · 8 comments
Closed

Libdoc: Include automatic argument conversion info #4160

pekkaklarck opened this issue Dec 3, 2021 · 8 comments
Milestone

Comments

@pekkaklarck
Copy link
Member

Currently Libdoc includes information about Enums and TypedDicts in its outputs (#3607, #3783). We are adding support for custom argument converters (#4088) and part of that is including information about these custom types in Libdoc outputs as well. It would be convenient if outputs would also contain information about types we automatically convert into. We could basically include same information that's in the User Guide. Information should be added only to types that are actually used by the library.

@pekkaklarck
Copy link
Member Author

pekkaklarck commented Dec 3, 2021

Thinks to remember:

  • If a type has built-in and custom converter, only show the latter info.
  • Support also extended types, ABCs and type aliases.
  • Include information about accepted argument types. This info should be added also to other data types.
  • Formatting of the documentation should take Library's documentation formatting into account.
  • Keep backwards compatibility with old versions so that we can still process old spec files.
  • Update XML and JSON schemas.
  • Show data types below keywords in the left column in HTML.

pekkaklarck added a commit that referenced this issue Dec 14, 2021
Move responsibility mostly to TypeConverter that is responsible on
conversion as well. This way information shown by Libdoc ought to be
consistent with actual conversion. It also makes it easier to get
information about built-in converters to Libdoc later (#4160).
@pekkaklarck
Copy link
Member Author

Spec files currently have data types listed so that enumerations, typed dicts and newly added custom converters all have their own listings. In JSON specs it looks like

"dataTypes" : {
    "customs": [...],
    "enums": [...],
    "typedDicts": [...]
}

This separation isn't too convenient in the common case where you want to operate with all types. For example, Libdoc's own HTML output needs to combine these lists together and sort them separately to get them into alphabetical order. Instead of adding new info about standard converters as another listing, a decision was made to store all type information as a single types list.

Each type in the types list will have a type attribute that can be used to separate e.g. enums from others if needed. All types will also have common attributes name, doc and usages (added as part of #4218), and they may also get information about accepted argument types. In addition to these common attributes, enums will have members and typed dicts will have items.

To avoid backwards incompatibility problems, the old dataTypes information will be preserved both in JSON and XML spec files. It will be considered deprecated and newly added information about custom converters will be removed.

pekkaklarck added a commit that referenced this issue Feb 6, 2022
`types` has all different types as a list with `type` telling are they
emuns, typed dicts or custom types. `dataTypes` had different entries
for sifferent types.

This change is preparation for adding information about all converted
types to Libdoc specs (#4160). It will be easier to add them, and to
process them, in same `types` list than adding yet another entry under
`dataTypes`. As `libdoc.html` changes show, having different types in
a single list is more convenient already now.

For backwards compatibility, old `dataTypes` is still written. It is
also parsed if `types` is not present.
pekkaklarck added a commit that referenced this issue Feb 6, 2022
`dataTypes` is deprecated and now restored to same structure and
content as in RF 4.x. All new additions, including custom types
(#4088), are only available under `types`. For some details see #4160.
@pekkaklarck
Copy link
Member Author

Type documentation will be stored under typedocs, not types, both in XML and JSON spec files.

pekkaklarck added a commit that referenced this issue Feb 9, 2022
Initial work. Actual docs mostly missing.
pekkaklarck added a commit that referenced this issue Feb 9, 2022
Only int and bool had docs earlier, others had TODO. Also enhance this
docs in the User Guide a bit.
@pekkaklarck
Copy link
Member Author

With the latest changes this issue is about to get ready. Things that still need to be done:

  • Decide should we include information about what argument types converters accept. We have that info for standard converters and custom converters can limit values as well. I'll look at this next to see how much work it would be.
  • Mention this in Libdoc documentation in the User Guide, possibly also in the Creating libraries section.
  • Proofread the docs.

The last point is something where others could help. Unfortunately it doesn't seem to be possible to attach HTML files to these issues so I needed to find a place where to host an example file or provide instructions how to generate one with all possible type docs.

@pekkaklarck
Copy link
Member Author

An example file is now available at http://uttermost-fairies.surge.sh/out.html. As mentioned above, proofreading the docs would be highly appreciated and other comments are obviously valuable as well.

pekkaklarck added a commit that referenced this issue Feb 10, 2022
Info is stored to specs under `accepts` and shown also in HTML.

This info makes it possible to separate normal Enums from IntEnums.
In HTML that knowledge is used for showing IntEnum values.
pekkaklarck added a commit that referenced this issue Feb 10, 2022
pekkaklarck added a commit that referenced this issue Feb 10, 2022
@pekkaklarck
Copy link
Member Author

Above changes added information about accepted types to outputs, added documentation to the User Guide, and also changed the usage listing of types to more compact variant. An example with all the latest changes is available at https://ruthless-scent.surge.sh/out.html. As a more realistic example, SeleniumLibrary documentation generated with the latest changes is at https://ruthless-scent.surge.sh/SeleniumLibrary.html.

I consider this issue done but it is likely that HTML output will still be changed before RF 5.0 final. Comments regarding to this functionality in general are still appreciated either here or in the #devel channel on our Slack.

@pekkaklarck
Copy link
Member Author

Little style tweaks to the Usages list still in the above commit. New examples available:

pekkaklarck pushed a commit that referenced this issue Mar 17, 2022
… end (#4280)

Related to showing showing type information about automatic argument conversion (#4160) and custom argument conversion (#4088) in Libdoc outputs.
@pekkaklarck
Copy link
Member Author

Thanks @samipe for creating modal dialog where the type info is shown. Lot nicer than listing this info at the end of the documentation.

@pekkaklarck pekkaklarck added the acknowledge To be acknowledged in release notes label Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant