Following on Claus’s work on https://issues.apache.org/jira/browse/CAMEL-16844
<https://issues.apache.org/jira/browse/CAMEL-16844> I investigated a different
approach to generating the tables of component and endpoint options. Some time
ago I wrote an Asciidoctor extension that queries a json document and renders
the results in various ways. Using this, it looks like the tables can be
generated during the Antora build using something like this:
== Component Options
[cols="2,5,^1,2",options="header",separator=|]
|===
| Name | Description | Default | Type
|===
jsonpathTable::example$json/ahc-ws.json['nodes$.componentProperties.*',
'*${path[2]}* (${value.group}),${value.description},${value.default ||
""},${value.type}']
== Endpoint Options
=== Path parameters
[cols="2,5,^1,2",options="header",separator=|]
|===
| Name | Description | Default | Type
|===
jsonpathTable::example$json/ahc-ws.json['nodes$.properties[?(@.kind=="path")]',
'*${path[2]}* (${value.group}),${value.description},${value.default ||
""},${value.type}']
=== Query Parameters
[cols="2,5,^1,2",options="header",separator=|]
|===
| Name | Description | Default | Type
|===
jsonpathTable::example$json/ahc-ws.json['nodes$.properties[?(@.kind=="parameter")]',
'*${path[2]}* (${value.group}),${value.description},${value.default ||
""},${value.type}']
This is not entirely complete, as the counts and a bit of text is left out.
I think this block (when completed) could be put in a partial with the json
file name as an attribute set in the including file. Then the component .adoc
would have only text specific to the particular component, and the layout of
the tables could be changed for all components by changing the included partial.
This would require exposing the json files from which the tables are
constructed in the Antora examples folder. I’d suggest using the Antora 3
symlink facility to do this and to avoid copying the component .adoc files.
Does this seem like an approach worth investigating further? If so I’ll work on
a PR.
David Jencks