Integrate <desc> and <category> for JSON#155
Conversation
Coverage ReportFor commit dcd3511 Click to expand Coverage Report Name Stmts Miss Branch BrPart Cover
--------------------------------------------------------------------------------
+ src/docbuild/models/deliverable.py 180 1 22 0 99.5%
+ src/docbuild/cli/cmd_check/process.py 58 0 22 1 98.8%
+ src/docbuild/cli/cmd_cli.py 93 1 8 1 98.0%
+ src/docbuild/utils/pidlock.py 79 1 14 1 97.8%
+ src/docbuild/config/xml/stitch.py 48 1 12 1 96.7%
+ src/docbuild/cli/cmd_validate/process.py 178 5 52 4 96.1%
+ src/docbuild/cli/callback.py 35 0 10 2 95.6%
+ src/docbuild/cli/cmd_metadata/metaprocess.py 172 10 42 7 92.1%
- src/docbuild/cli/cmd_config/__init__.py 9 1 0 0 88.9%
- src/docbuild/cli/cmd_check/__init__.py 18 5 2 0 65.0%
- src/docbuild/cli/cmd_build/__init__.py 13 5 0 0 61.5%
- src/docbuild/cli/cmd_metadata/__init__.py 27 10 2 0 58.6%
- src/docbuild/cli/cmd_config/environment.py 11 6 2 0 38.5%
--------------------------------------------------------------------------------
+ TOTAL 2840 46 646 17 98.0%
47 files skipped due to complete coverage. |
63d3746 to
d6a35b9
Compare
<desc> and <category> for JSON
8092473 to
93c4776
Compare
<desc> and <category> for JSON<desc> and <category> for JSON
Hi @tomschr, thanks for the great work. The PR successfully implements the extraction and serialization of localized descriptions and categories from the XML configuration into the JSON manifest. The architecture is robust, particularly in how it handles the inheritance of categories from both the product and root nodes. I noticed that Overall, this is a great addition to the metadata pipeline. LGTM. |
Ahh, good point! Haven't thought about this. Yes, I've added it to "number" the categories so I can avoid any arbitrary attribute or element.
That sounds like a good idea! I will investigate that. |
The `<desc>` element in the XML configuration contains language-specific descriptions. It is used in the index pages of each product release. This PR adds the missing handling of this element. * Build `Description` model for `Manifest` * In `Deliverable`, create new methods (see below). They transform the `<desc>` element * `all_categories`: Return the categories of the deliverable. * `categories`: Return the categories from the product node. * `categories_from_root`: Return the categories from the root node. * For submodels of `Manifest`, add serialization method (e.g., for `lang` attribute) * Improve test cases * Update doc sources of auto API * Make `Category.rank` set automatically * Add translations to `Category.translations`
Co-authored-by: Sushant Gaurav <[email protected]>
109fa25 to
0b21971
Compare
0b21971 to
1cbd4eb
Compare
The
<desc>and ` elements in the XML configuration contains language-specific descriptions. It is used in the index pages of each product release.This PR integrate these elements into the JSON output (the keys
descriptionsandcategories):{ "productname": "...", "acronym": "...", "version": "...", "lifecycle": "supported", "hide-productname": false, "descriptions": [ { "lang": "en-us", "default": true, "description": "..." } ], "categories": [ { "categoryId": "best-practice", "rank": 1, "translations": [ { "lang": "en-us", "default": true, "title": "Best practices" } ] } ] }This PR adds the missing handling of these elements.
Descriptionmodel forManifestDeliverable, create new methods (see below). They transform the<desc>elementall_categories: Return the categories of the deliverable.categories: Return the categories from the product node.categories_from_root: Return the categories from the root node.Manifest, add serialization method (e.g., forlangattribute)Category.rankset automaticallyCategory.translations