Refactor generate jsonmap - #271
Draft
tomkane-dls wants to merge 2 commits into
Draft
tomkane-dls wants to merge 2 commits into
tomkane-dls wants to merge 2 commits into
Conversation
tomkane-dls
marked this pull request as draft
September 17, 2026 13:44
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #271 +/- ##
==========================================
+ Coverage 96.04% 96.61% +0.56%
==========================================
Files 13 17 +4
Lines 986 1033 +47
==========================================
+ Hits 947 998 +51
+ Misses 39 35 -4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tomkane-dls
requested review from
OCopping and
adedamola-sode
and removed request for
OCopping
September 17, 2026 14:11
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refactor generate jsonmap
Kept generate_jsonmap.py at the top level, but split the internals into four files within jsonmap/:
nodes.py,links.py,naming.py,crawl.py. Added dataclasses like WidgetLink and CrawlContext to group things a little more intuitively. Nearly all the changes are purely cosmetic, the code produces identical jsonmaps to what it did previouslyChanges
nodes.pyJsonMap->ScreenNode_serialise_json_map->serialise_node_check_defaultand refactred and replaced withfield_defaultlinks.pygenerate_json_mapnow moved toextract_linksWidgetLinkis now a dataclass (file,name,type,macros)StrEnumcalled WidgetTypeextract_file_textandis_bob_child_file_crawlnowresolve_link_pathandfind_local_screenexistsrule for unfound files moved toassumed_existsnaming.py_get_component_labelrenamed tofind_techui_labeland moved tojsonmap/naming.py; it now returns the label orNone._parse_display_name->name_or_file_stem_fix_names_json_map->fix_duplicate_names_get_display_name- display-name order written out incrawl.crawl.pyJsonMapGenerator.generate_json_mapnow incrawl_child_file_crawlnow incrawl_linkand takes aWidgetLink.CrawlContextto pass between recursion stepsCrawlContext.with_screen_component.generate_jsonmap.pyJsonMapGenerator._current_service_nameremoved; the service name is passed down inCrawlContextJsonMapGenerator.generate_json_mapnow builds aCrawlContextand callscrawl.Tests
moved/updated:
test_serialise_json_maprenamed totest_serialise_nodeand moved totests/jsonmap/test_nodes.py.test_parse_display_name_*renamed totest_name_or_file_stem_*and moved totests/jsonmap/test_naming.py.test_fix_names_json_map_recursiverenamed totest_fix_duplicate_names_recursiveand moved totests/jsonmap/test_naming.py.test_get_component_label*renamed totest_find_techui_label*and moved totests/jsonmap/test_naming.py; the invalid-name tests expectNone.test_get_action_group*andtest_get_nav_tabs*moved totests/test_utils.py.test_generate_json_map_get_macrosandtest_generate_json_map_other_exceptionpatchtechui_builder.jsonmap.links._get_action_group.test_generate_json_map,test_generate_json_map_embedded_screen,test_generate_json_map_nav_tabs,test_generate_json_map_get_macrosandtest_generate_json_map_other_exception._get_action_grouppatch removed fromtest_generate_json_map.test_generate_json_map_embedded_screenexpects display name"Z".test_write_json_mappatchestechui_builder.generate_jsonmap.serialise_node.tests/conftest.pyusesScreenNodefromtechui_builder.jsonmap.nodes.tests/test_autofiller.pypatchestechui_builder.autofill.objectify.deannotateandlxml.etree.ElementTree.new tests:
tests/test_utils.py:test_get_macros.tests/jsonmap/test_nodes.py:test_field_default.tests/jsonmap/test_links.py:test_extract_links,test_resolve_link_path,test_find_local_screen,test_assumed_exists.tests/jsonmap/test_crawl.py:test_crawl,test_crawl_component_screen,test_crawl_link,test_with_screen_component.