feat: add support for metadata comments in samples #230
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.
This adds support for providing additional sample meta-information, based on comments embedded within sample files, like so:
Fields we currently intend to support:
title
: a human readable title for the sample.description
: description of a sample.usage
: usage instructions for a sample, e.g.,node sample.js --hello
.api_version
: what version of the API does this sample apply to, e.g., v1beta, v2.Future Work
We would like to eventually also support a
snippets
field, which includes meta information about individual snippets, if multiple snippets are included in the sample file; this has not yet been implemented, as it's not currently used in Node'ssamples/README.md
orREADME.md
, which will be the first two consumers of this functionality.Note
It's our hope that in the future this meta information will be automatically populated as samples are generated.
CC: @beccasaurus who was also involved in this discussion.