-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Support global scope type converters #4944
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
Comments
This would be a good enhancement. A relatively simple solution would be exposing from robot.api import TypeConverter
@TypeConverter.register
class MyConverter(TypeConverter):
... Would that work for you @JFoederer? Exposing
Nothing above is too complicated, but there's quite a bit to do. I won't personally have time for that withing RF 7.0 timeframe, but I'd be happy to help and review PRs if you @JFoederer or someone else want to take a look at this. |
Yes, that would work, because that is the exact method I am now using as a work around. My proposal is to first bring my own library up-to-date with the RF7 changes, secretly still using the unexposed interface. If that works fine we at least have a working example and it gives us some time to think a bit broader and investigate possible alternatives, without the time pressure. It would be great to formalize this towards RF8 though. |
Sounds good. I don't think this is too big a task and it shouldn't have any backwards compatibility concerns, so it could be done already in RF 7.1. We basically just need to make sure the TypeConverter API is as lean as possible and we don't accidentally expose internal logic publicly. There most likely isn't time to get this done in RF 7.0. That said, if you have ideas how to enhance the TypeConver now so that it would work better as an official public API, let me know. If we can make the API stable already now, then it's easy for users to support also RF 7.0 by just importing TypeConverter from a different place. |
A few considerations regarding libdoc around this topic:
|
Potential issue with libdoc. If the non-technical type name contains spaces, then the html render fails to display the type's docs in the type info dialog. |
Quick comments to the topics above:
|
Issue submitted as requested for the html rendering. |
I would like to register a custom type in general, rather than with a specific keyword library.
I like creating keyword libraries for certain, more complex, data types. Keywords than include factory keywords, operator keywords and some for managing storage. Other keyword libraries can then refer to these types and take them as argument, in which case the converters are super handy, but they aren't available at that place.
In my current solution I reverted to subclassing
TypeConverter
but this is not part of the public API. It would be better to have the option to register a custom type in general, so that any keyword library that uses the type can also benefit from the converters.The text was updated successfully, but these errors were encountered: