fix(buml-builder): export all object models in multi-object projects#572
Merged
Merged
Conversation
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
This was referenced Jul 8, 2026
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.
What & why
Fixes BESSER-Web-Modeling-Editor#161: exporting a project with a class model + multiple object models to a B-UML
.pyfile dropped every object model (JSON export was unaffected).Root cause
project_builder.py's standalone-object loop only wrote a model whengetattr(om, "domain_model", None)was truthy — butObjectModelhas nodomain_modelattribute, so the branch never ran and the models were never added toProject(models=[...])either. Single object model worked only via a separate 1:1 special case.Fix
domain_model_to_codeinto a reusableobject_model_to_code()(domain_model_to_codeoutput is byte-identical).Tests
test_project_multiple_object_models_are_exported: 1 domain + 2 object models → asserts both survive export and the generated fileexec()s back to 2 ObjectModels. Fails without the fix (0 == 2), passes with it.