Skip to content

Fix: Integrate offline validation for SBase unit assignments - #322

Open
dyrpsf wants to merge 1 commit into
sbmlteam:masterfrom
dyrpsf:feature/resolve-unit-validation-todo
Open

Fix: Integrate offline validation for SBase unit assignments#322
dyrpsf wants to merge 1 commit into
sbmlteam:masterfrom
dyrpsf:feature/resolve-unit-validation-todo

Conversation

@dyrpsf

@dyrpsf dyrpsf commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Resolve TODO: Integrate offline validation for SBase unit assignments

Description
This PR resolves the pending TODO in AbstractNamedSBaseWithUnit.java by shifting unit assignment validation to utilize the JSBML offline validation framework.

Previously, programmatic assignment of an invalid unit triggered a hard IllegalArgumentException, which disrupted model building. This update ensures that invalid unit assignments now gracefully register an SBMLError within the associated SBMLDocument's error log (tracking SBMLErrorCodes.CORE_10311 syntax requirements), maintaining execution flow while strictly enforcing SBML specifications.

Architectural Changes

  • Validation Shift: Updated setUnits(String) to check for a valid SBMLDocument context and append an SBMLError upon invalid unit assignment.
  • Isolated Node Handling: Maintained the IllegalArgumentException fallback for isolated nodes lacking a document context.
  • Test Verification: Verified successfully against TestAbstractNamedSBaseWithUnits using Maven targeted testing.

cc: @draeger

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