-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Generate reference documentation and XSD from metadata #1955
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
A loose list of metadata formats we might consider:
|
@ppkarwasz, I completely support the research phase you described. Though I will also appreciate some non-Maven-native solutions (besides an XSD) too. |
Sure thing, my research is not complete. Maven-related formats were just the easiest to find. |
Neat, this is an idea I've had in the past. It would be great if we had proper XSDs that made it easier to edit a log4j configuration file. Might be useful to see if this schema can be represented as a JsonSchema, too, so it can be used for JSON and YAML configuration files. One potential source of inspiration here would be whatever Spring Boot does for making your various I should note that various old plugins still use strings for various plugin attributes that should be a different data type, but the initial plugin system only supported string values for attributes as it mimicked the DOM API here. Thus, if you use the type info of a plugin attribute, note that a string type is not necessarily authoritative. |
The main plan here is to have a documentation like Maven plugins (e.g. Maven Compiler Plugin). These are generated without a single line of text (besides the
The XSD will be a byproduct of this process, but the metadata must be a little bit larger: in February-March we plan to write an online configuration builder/validation tool. This tool might also spit up a list of Maven dependencies required by the configuration. |
Oh that all sounds fantastic! |
Our plugins can be approximately modeled as JavaBeans, i.e. as Java classes with a set of documented properties, so a descriptor of a Log4j plugin must allow:
The second requirement limits the list of available read-to-use component descriptors: Plexus component descriptors do not allow properties of any type. An XSD schema might also not be enough to precisely document our components: there is no standard way to convey inheritance in an XSD. We should probably leave XSD as a product of our documentation process. |
A second requirement from the metadata format is the availability of tools to generate various formats of documentation:
This leaves Modello that has an impressive number of generators and the custom Maven Plugin descriptor as contenders. The documentation of Maven Plugin descriptor is actually generated by Modello. |
An experiment performed using Modello (cf. the Log4j Documentation Reference using Modello gist), shows that even if we use a Modello descriptor to describe Log4j plugins, we would need to write the documentation logic ourselves (even for "just" an XSD). That is why I believe:
|
How would you compare these solutions to simply rendering an XSD/JSON and mapping it to a |
@vy, These solutions are quite rigid. The one that gave the best result (Modello) would still need some code modifications in Therefore I think that the easiest solution is to:
The maps we probably need are:
|
Given XSD is an XML too, I would favor simply passing XSD model to FreeMarker (through a simple |
I thought to use Modello only as an implementation detail.
No, this will be transparent for the user.
The XSD schema will cover only part of our plugins (those in the "Core" namespace). |
This translates to
How would you compare this to the following?
|
Modello will only be used to generate code for XML serialization/deserialization and the model itself. Once that is done it will be:
|
The module contains a commons XML model to document a JARs containing Log4j plugins. Part of apache/logging-log4j2#1955.
With the submission of the PRs above, I consider this subtask complete. |
Log4j plugins follow a slightly modified JavaBean model. As a first step of #1954 we should:
The text was updated successfully, but these errors were encountered: