Hi all, I’m trying to generate JSON files in order...
# dokka
f
Hi all, I’m trying to generate JSON files in order to feed spring-auto-restdocs, which is still using dokka v0.10.1 at the moment. I’m a bit lost in dokka’s plugin model, maybe someone of you can help: is it possible to generate files in pure JSON format with the currently existing extension points? if yes, what would be needed to do so?
i
Hi! What kind of information do you want to have in the generated json? Whole API reference? Like html and markdown formats, only json?
If so, you can have a look at the gfm plugin, CommonmarkRenderer in particular (might also have a look at HtmlRenderer, but it's a bit more complex) These renderers deal with Content model, you can think of it as some sort of IR between source code and an output format. If you find that you need some info closer to the source code, it's also possible, just need to add a different extension You can have a look at SingleModuleGeneration to learn about the main stages and extension points. Hope this helps!
f
Hi Ignat, thanks for the details! to make it short, I only need kdoc documentation of classes in a certain json structure. for example, this class produces the following json (using dokka 0.10.1):
what I’ve tried is to implement a new JsonRenderer, but I could not find out how to get the kdoc information out of a
PageNode
i
Renderers are supposed to be an abstraction over displaying data in a certain way (i.e how to handle tables, groups, styles). The content itself is generated by dokka during previous stages So if you don't need fine grained control over the resulting structure and just need a json output file - I think renderers should work for you if you want access to kdoc information itself, perhaps you need a lower level extension point