-
Notifications
You must be signed in to change notification settings - Fork 191
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
Generated Java/C# code is missing docstrings of verbose enum entries #1068
Comments
I can say for sure that docstring generation was never implemented for Java or C#. I'm not sure if we even have standards to specify these so it will be picked up properly by IDEs and javadoc / xmldoc. For the record, it was never advertised as "it will generate docstrings". KS docs merely says:
|
Well, the user guide says that docstrings added in
Furthermore, the https://doc.kaitai.io/user_guide.html#ksy-documentation section clarifies that not only sequence attributes but also other symbols can be documented. Verbose enums are missing there, but I don't think it's intentional. @GreyCat Anyway, can we agree that it would be good to propagate enum entries' docstrings to the generated code whenever possible so that they can be picked up by IDEs?
I've been thinking for quite some time that we need special tests in KST repo for the presence and readability of generated docstrings. I know that these tests might not be that easy to make in all languages, because I guess in many languages, comments are not accessible at runtime (Python, where you can access the docstring via the |
Another way to check it is just generate unique docstrings and check presence of them in the generated files. Of course, this will not protect against wrong placed comments, but at least it will ensure that documentation was generated. |
Yeah, absolutely no concern about the intent — I'm a bit careful as I'm not sure if this is possible to get these corner cases like verbose enums for all target languages to export docstrings. @Mingun Like your idea — it's really simple and easy to implement. Longer term, we can actually extrapolate to what @generalmimon suggests, that is not just grepping through generated sources, but really trying to find these generated strings in generated documentation or some kind of docstrings database that IDE might use. |
KST-wise, what do you folks think of something like that? id: foo_bar
data: expr_array.bin
asserts:
- actual: aint_size
expected: 4
docstrings:
- contains: Sample documentation for foo
- contains: Some other random stuff we put in For now, it will generate a separate test that will check existence of these substrings in generated sources. Later on, based on language, we can run actual documentation generator (javadoc, yard, Sphinx, etc), and either grep it blindly there, or even be more specific on where this should be found. |
Are Verbose enums actually working?
I have used Kaitai various versions(0.8 0.9 0.10), different language output(java, C#), different ksy file from official repo, and different platform(windows, linux), none of them have generate the enum comment string.
The text was updated successfully, but these errors were encountered: