Skip to content
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

Generate spec docs from a YAML source file #1588

Merged
merged 6 commits into from
Mar 29, 2023
Merged

Generate spec docs from a YAML source file #1588

merged 6 commits into from
Mar 29, 2023

Conversation

bgilbert
Copy link
Contributor

Move all field descriptions to a single YAML file and generate version-specific spec docs from that. Use reflection to walk the config structs for each version and omit fields which don't exist in a particular spec version. Also allow the YAML file to include transformation rules for each field, consisting of a spec version range, a regex, and replacement string.

We don't do this at a JSON Schema level because e.g. Resource is referenced in multiple places with different semantics and different doc strings.

For now, keep the code out of the external API. The plan is to add functionality to support Butane docs generation (coreos/butane#390), at which point internal/doc/generate will move to config/doc.

Fixes #1469 and various small docs errors.

@travier
Copy link
Member

travier commented Mar 27, 2023

👍🏻 Looks cool. The nice diff of fixes is already a win.

Move all field descriptions to a single YAML file and generate version-
specific spec docs from that.  Use reflection to walk the config
structs for each version and omit fields which don't exist in a
particular spec version.

We don't do this at a JSON Schema level because e.g. Resource is
referenced in multiple places with different semantics and different
doc strings.

For now, keep the code out of the external API.  The plan is to add
functionality to support Butane docs generation, at which point
internal/doc/generate will move to config/doc.

Update the stabilization checklist to remove manual tweaking of
spec docs.
Move link URLs inline and fix various small errors.

Fixes #1469.
@prestist prestist self-requested a review March 28, 2023 16:02
Copy link
Collaborator

@prestist prestist left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, thank you so much for this feature. Its going to reduce so much user error moving forward.

Great idea and implementation; LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider generating spec docs from a machine-readable description
3 participants