Skip to content

fix(java-templates): custom templates needs to load partial metadata#788

Merged
chingor13 merged 4 commits intogoogleapis:masterfrom
chingor13:partials
Oct 8, 2020
Merged

fix(java-templates): custom templates needs to load partial metadata#788
chingor13 merged 4 commits intogoogleapis:masterfrom
chingor13:partials

Conversation

@chingor13
Copy link
Copy Markdown
Contributor

@chingor13 chingor13 commented Oct 7, 2020

Refactors partial parsing into a separate module for re-use.

For java, we are using CommonTemplates.render() which does not include any magic metadata loading like CommonTemplates._generic_library() does. Instead allow the partial yaml parsing to be used externally and explicitly load the partial metadata in the java.custom_templates() helper. This fixes the README generation from our README autosynth.

Fixes #791

@google-cla google-cla Bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 7, 2020
Comment thread synthtool/gcp/partials.py
def load_partials(files: List[str] = _DEFAULT_PARTIAL_FILES) -> Dict:
"""
hand-crafted artisinal markdown can be provided in a .readme-partials.yml.
The following fields are currently supported:
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I like this refactor 👍

It might be worth running the branch against one Node.js repo that uses partials, just to make sure it behaves as expected.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Ran this against nodejs-storage and it succeeded with no changes to the README.md

@chingor13 chingor13 merged commit b6164c2 into googleapis:master Oct 8, 2020
@chingor13 chingor13 deleted the partials branch October 8, 2020 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Split Java README job is not loading readme-partials.yaml

4 participants