Skip to content

fix(buml-builder): export all object models in multi-object projects#572

Merged
ArmenSl merged 1 commit into
developmentfrom
fix/buml-export-multiple-object-models
Jul 8, 2026
Merged

fix(buml-builder): export all object models in multi-object projects#572
ArmenSl merged 1 commit into
developmentfrom
fix/buml-export-multiple-object-models

Conversation

@ArmenSl

@ArmenSl ArmenSl commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

What & why

Fixes BESSER-Web-Modeling-Editor#161: exporting a project with a class model + multiple object models to a B-UML .py file dropped every object model (JSON export was unaffected).

Root cause

project_builder.py's standalone-object loop only wrote a model when getattr(om, "domain_model", None) was truthy — but ObjectModel has no domain_model attribute, so the branch never ran and the models were never added to Project(models=[...]) either. Single object model worked only via a separate 1:1 special case.

Fix

  • Extract the object-writing block from domain_model_to_code into a reusable object_model_to_code() (domain_model_to_code output is byte-identical).
  • Emit every standalone object model (object-only, referencing the domain classes already written above in the concatenated file).

Tests

  • New test_project_multiple_object_models_are_exported: 1 domain + 2 object models → asserts both survive export and the generated file exec()s back to 2 ObjectModels. Fails without the fix (0 == 2), passes with it.
  • Broader sweep (builder + object metamodel + converter roundtrip): 236 passed, no regressions.

project_to_code dropped every object model when a project had a domain
model plus more than one object model: the standalone-object loop only
wrote a model when getattr(om, "domain_model", None) was truthy, but
ObjectModel has no domain_model attribute, so the branch never ran and
the models were never added to the Project(models=[...]) list either.

Extract the object-writing block from domain_model_to_code into a
reusable object_model_to_code() and emit every standalone object model
(object-only, referencing the domain classes written earlier in the
concatenated file). JSON export was unaffected; this brings the Python
B-UML export to parity.

Fixes BESSER-Web-Modeling-Editor#161
@ArmenSl ArmenSl merged commit f420038 into development Jul 8, 2026
ArmenSl added a commit that referenced this pull request Jul 8, 2026
…ect projects

- Bump setup.cfg 7.11.1 -> 7.11.2 and add v7.11.2 release notes.
- Backend: fix(buml-builder) exporting all object models in multi-object
  projects (PR #572), fixing web editor issue #161. No frontend or
  modeling-agent changes.
@ArmenSl ArmenSl deleted the fix/buml-export-multiple-object-models branch July 8, 2026 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant