Repository navigation
Fix schema parsing of complexType children - #231
Merged
Merged
Conversation
The schema tree viewer showed no children for elements used via ref="auc:X" when the global element X is declared as <xs:element name="X" type="auc:XType"/> and XType is a named xs:complexType (e.g. FanBased, TimeSeries, CalculationMethod, PortfolioManager). _walk_named_element only followed the element's type when it resolved to a simpleType. - Walk the named complexType in _walk_named_element - Add a parser test with a minimal XSD comparing a ref'd element to a local name+type element of the same type Fixes #229 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The reparse command overwrites live generated HTML even during --dry-run, creating filesystem changes that database rollback cannot undo and risking truncation if the write fails.
3 open issues
What changed in this PR
Fixes #229 by expanding referenced elements with named complex types, allowing their children to appear in the schema viewer. Adds a reparse command to rebuild stored trees while preserving schema records, use cases, uploaded files, and existing BEDES mappings.
Changes:
- Extend complex-type traversal and add focused regression tests.
- Add transactional reparsing with mapping restoration, reporting, and a dry-run option.
- Update Docker startup and document reparsing and manual BEDES loading.
| File | Description |
|---|---|
| README.md | Documents reparsing, preservation behavior, and BEDES CSV handling. |
| docker/start_server.sh | Imports the default schema and removes automatic BEDES loading. |
| bsyncviewer/tests/test_schema_parser.py | Tests referenced complex-type children, paths, levels, and indexes. |
| bsyncviewer/tests/test_reparse_schema.py | Tests rebuilding, mapping restoration, dry runs, and invalid versions. |
| bsyncviewer/tests/data/test_ref_complex_type.xsd | Provides a minimal referenced complex-type fixture. |
| bsyncviewer/management/commands/reparse_schema.py | Adds tree rebuilding and BEDES mapping restoration. |
| bsyncviewer/lib/schema_parser.py | Traverses named complex types reached through element references. |
Review effort: Balanced
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Coverage Report for CI Build 45240676996Coverage increased (+1.3%) to 84.375%Details
Uncovered Changes
Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
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.


Fixes #229: the schema viewer showed no children for FanBased, TimeSeries, CalculationMethod and PortfolioManager. These elements are used via ref="auc:X", and the global X has a named complex type. The parser only followed that type when it was a simple type (an enumeration).
This fix adds a new branch in schema_parser.py:456 that also walks a named complex type. Only those four elements gain rows; nothing existing is removed. For 2.7.0 that’s 296 new rows.
Consequences:
The fix shows up only after a re-parse. Each version’s tree is stored in the database, so deploying the code alone changes nothing.
reset_schema deletes the Schema row, and its use cases go with it.
Unchecking “schema parsed” in the admin builds a second copy of the tree.
The committed BEDES CSVs will now be stale and will need to be regenerated for posterity.