-
Notifications
You must be signed in to change notification settings - Fork 47
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
feat!: generate docs from code #645
Conversation
The generated markdown does not include the The generated example Validated examples could help with crossplane-contrib/provider-jet-equinix#29 (comment) |
PR was in a weird state, none of the templates were present.
The examples were extracted from the hand-written docs during The templates are all generated from the existing docs, so there isn't a whole lot of true generation happening in this PR yet. In the few places where templates have been updated to use more generation (provider and device resource as of now), there is still quite a bit of work to do to move or reproduce descriptions and the like so that they are picked up by the generator to reduce the diff between the hard-coded and generated docs. |
Might as well wait for #683 before pursuing docs generation |
Could include or rebase off #685 |
This PR is now based on & blocked by #683. |
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #645 +/- ##
==========================================
- Coverage 37.91% 34.44% -3.47%
==========================================
Files 120 151 +31
Lines 19476 20634 +1158
==========================================
- Hits 7384 7108 -276
- Misses 11884 13364 +1480
+ Partials 208 162 -46 ☔ View full report in Codecov by Sentry. |
@equinix/governor-digin-fabric @equinix/governor-ne-network-edge-engineering please take a look. This PR does not change the contents of your documentation, although it does change the URL for some pages to match the convention recommended by Hashicorp and used by the vast majority of terraform providers (for example |
Installed tfplugindocs: export GOBIN=$PWD/bin export PATH=$GOBIN:$PATH go install github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs which tfplugindocs Created templates from existing docs: tfplugindocs migrate
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.
looks pretty good! I like the docs-check approach too simple and useful
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.
All good from a Fabric perspective. Looking forward to a point where we can start reducing the number of templates to allow the process to handle generation fresh once we get a handle on it.
Thanks, Charles!
Our existing provider docs are prone to errors because we transcribe attribute descriptions, deprecations, etc. back and forth between the code and docs by hand. By generating docs from code, we reduce the overhead of providing accurate, up-to-date docs for our customers.
Note that this is a breaking change because, prior to this PR, docs for an Equinix resource or data source were kept in a file named
equinix_<resource>.md
. The recommendation from Hashicorp is to keep docs in a file named<resource>.md
(without theequinix_
prefix), and theterraform-plugin-docs
tool strictly follows this recommendation. This means that adopting docs generation would move our existing docs from, e.g.https://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/equinix_metal_vrf
tohttps://registry.terraform.io/providers/equinix/equinix/latest/docs/resources/metal_vrf
.This PR adopts docs generation as follows:
tfplugindocs migrate
to create templates from our existing docstfplugindocs generate
to regenerate the docs from the newly-created templatesNOTE the scope of this PR is to move our docs to align with the HashiCorp's recommended structure & naming conventions and to provide an example of updating existing templates to automatically generate resource / datasource attribute details. Updating specific templates is the responsibility of each engineering team.
Closes #201