-
Notifications
You must be signed in to change notification settings - Fork 101
feat(rfc): automatic documentation generation #1544
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
Open
pront
wants to merge
4
commits into
main
Choose a base branch
from
pront-docs-generation-rfc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61ba9c6 to
167f2d4
Compare
ecfc8b0 to
48742cf
Compare
8e205e1 to
e49b7d5
Compare
e49b7d5 to
b26a897
Compare
Comment on lines
+135
to
+164
| 4. Provide documentation to the website. There are couple of options here: | ||
| * [Rejected] Directly convert documentation into json and insert it into `data/docs.json` | ||
| - Cons | ||
| * no documentation present in any cue files in the Vector repo, making it harder to | ||
| notice if the website needs to be updated. | ||
| * Docs team and maintainers will probably not see any VRL documentation changes (during | ||
| releases). | ||
| * (minor) Less visibility into VRL documentation when checking out old source code | ||
| - Pros | ||
| * VRL source code is the sole source of truth and updating docs is simply running website | ||
| deploy commands and one additional `vdev` command. | ||
| * No binary documentation files or duplicated information in repos anywhere. | ||
| * [Rejected] Convert documentation into cue files and keep the regular flow. | ||
| - Cons | ||
| * VRL source code is not the sole source of truth. | ||
| * VRL documentation has to be updated in two repos. | ||
| * Need to generate cue files when updating VRL. | ||
| * We'd be generating cue in a very hacky manner and we want to move away from cue wherever | ||
| possible | ||
| - Pros: | ||
| * More visibility into documentation changes. This makes it easier to notice if the website needs | ||
| to be updated since CI checks will catch differences in generated files. | ||
| * Convert documentation into pretty printed JSON file. | ||
| - Cons | ||
| * VRL source code is not the sole source of truth. | ||
| * VRL documentation has to be updated in two repos. | ||
| * Need to generate json files when updating VRL. | ||
| - Pros: | ||
| * More visibility into documentation changes. This makes it easier to notice if the website needs | ||
| to be updated since CI checks will catch differences in generated files. |
Contributor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback appreciated here
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
no-changelog
Changes in this PR do not need user-facing explanations in the release changelog
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This RFC is not ready for prime time but it discusses critical points.
The goal is to hand it over to a new engineer and transfer ownership.
Change Type
Is this a breaking change?
How did you test this PR?
Does this PR include user facing changes?
our guidelines.
Checklist
run
dd-rust-license-tool writeand commit the changes. More details here.References
Rendered RFC
RFC 2025-10-27 - VRL Function Documentation Auto-Generation
Context
VRL function documentation has always been manually maintained in separate CUE files (
website/cue/reference/remap/functions/*.cuein theVector repository), which is error-prone and leads to documentation drift. The separation of VRL into its own repository has made this
problem worse: contributors adding VRL functions must now create PRs in two repositories - one for the function implementation (VRL
repo) and another for the documentation (Vector repo). This cross-repository requirement creates friction, increases the likelihood of
missing or outdated documentation, and makes the contribution process more complex.
This RFC proposes an automated system for generating VRL function documentation directly from the Rust source code where functions are
defined, ensuring documentation stays synchronized with implementation and eliminating the need for cross-repository documentation PRs.
Cross references
**: website/cue/reference/remap/functions/ -
Current manual documentation location
https://github.com/vectordotdev/vrl.gitScope
In scope
Functiontrait implementationssrc/stdlib/in this repository)vrl::stdlib::all()from the current VRL versionOut of scope
all VRL functions are present in the
vrl::stdlib::all()vector. This RFC focuses ondocumentation and not (code generation for) automatic function discovery
Pain points
Current state problems
Adding a VRL stdlib function requires two PRs in separate repositories:
Critical issues:
Prior art
Similar documentation generation systems:
rustdoc- Extracts docs from code, proves viability of code-as-source-of-truthProposal
Architecture overview
Technical approach
Expand the
Functiontrait. Currently it containsidentifier,summary,usage,examples. It ismissing
internal_failure_reasons,description,returnandcategory. Note thatusageanddescriptionshould be equivalent.Once the
Functiontrait is updated, port all documentation currently present in Vector cue functionshere
into VRL's source code. Once the PR is merged, update VRL inside of Vector and do the same for
Vector-specific VRL functions.
Create a vdev command (in Vector's repo) to generate documentation based solely on the methods
provided by the
Functiontrait.Provide documentation to the website. There are couple of options here:
data/docs.jsonnotice if the website needs to be updated.
releases).
deploy commands and one additional
vdevcommand.possible
to be updated since CI checks will catch differences in generated files.
to be updated since CI checks will catch differences in generated files.
Future work
Additional capabilities:
Success metrics
References