opensearch-project / opensearch-project/data-prepper

[Proposal] Automatic Plugin Documentation

Open
#475 0 comments 1 reaction 1 assignee View on GitHub

@dlvenable is already working on this.

Since Oct 26, 2021.

backlog proposal
Dominant language
Java
Stars
374
Forks
354
Avg merge
3d 18h
Merged PRs (30d)
8

Description

Is your feature request related to a problem? Please describe.

The documentation for plugins should be consistent and easy to use for users of Data Prepper.

Documenting plugins should be easy for plugin developers.

Describe the solution you'd like

This proposal builds on the proposal from #469.

In #469, I proposed that Data Prepper support POJO models for plugin configurations. Another extension to this approach would be the ability to support dynamically generated documentation for Data Prepper from these models.

Here is an example which builds upon the example I used in #469:

class HttpSourceConfig {
  @Min(0)
  @Max(65535)
  @DataPrepperPluginDocumentation(description = "The port on which the HTTP server runs")
  private int port = 2021;

  @Min(0)
  @DataPrepperPluginDocumentation(description = "The request timeout for the HTTP server")
  private int requestTimeout = 10_000;
  ...
}

Data Prepper could determine the following dynamically:

  • The documentation text
  • The requirements stated using JSR 303 validation. This would require an understanding of specific validation annotations though.
  • The data type

I also believe it may be possible to also determine:

  • The default value (would require instantiating an object, so it might not be ideal)
  • The property name. I would really only want to do this if Data Prepper can get Jackson to provide an authoritative answer.

Depending upon the difficult of the latter two, the annotation could look like the following instead:

@DataPrepperPluginDocumentation(key = "request_timeout",
  description = "The request timeout for the HTTP server",
  defaultValue = "10,000")

With the following information, Data Prepper could then support two approaches to documentation:

  1. As part of the build process, auto-generate HTML-based documentation
  2. Support a command-line help using this documentation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.