Skip to content

Document offline validation as the default and add test (#246)#281

Open
dyrpsf wants to merge 1 commit intosbmlteam:masterfrom
dyrpsf:fix-offline-validation-default
Open

Document offline validation as the default and add test (#246)#281
dyrpsf wants to merge 1 commit intosbmlteam:masterfrom
dyrpsf:fix-offline-validation-default

Conversation

@dyrpsf
Copy link
Contributor

@dyrpsf dyrpsf commented Feb 2, 2026

This PR addresses #246.

Summary

SBMLDocument.checkConsistency() already delegates to checkConsistencyOffline(), so offline validation is effectively the default. However, the Javadoc still claimed that validation was "currently performed using the SBML.org online validator". This PR:

  • updates the documentation to match the actual behaviour, and
  • adds a small regression test to ensure checkConsistency() continues to use the offline validator.

Changes

  1. Javadoc updates in SBMLDocument

    • core/src/org/sbml/jsbml/SBMLDocument.java
      • checkConsistencyOffline() Javadoc now explains that the offline validator is used by default when calling checkConsistency(), and points to checkConsistencyOnline() as the alternative.
      • checkConsistency() Javadoc is updated to state that validation is performed using the JSBML internal offline validator, with the SBML.org online validator still available via checkConsistencyOnline().

    Note: No executable code was changed; only comments/Javadoc were modified.
    The method remains:

    public int checkConsistency() {
      return checkConsistencyOffline();
    }
  2. New unit test

    • Added core/test/org/sbml/jsbml/test/SBMLDocumentValidationModeTest.java
    • The test creates a small TestDocument subclass of SBMLDocument that overrides:
      • checkConsistencyOffline() and
      • checkConsistencyOnline()
        and records which one is called.
    • The test checkConsistencyUsesOfflineValidatorByDefault() asserts that:
      • checkConsistency() calls the offline variant,
      • does not call the online variant,
      • and returns the offline method’s result.

    This guards against future regressions where checkConsistency() might accidentally call the online validator again.

Tests

Executed locally:

  • mvn -pl core test

Test Results

The newly added regression test behaves as expected and passes successfully.

@ntung
Copy link

ntung commented Feb 14, 2026

It's very helpful work! Thank you @dyrpsf The BioModels repository is struggling with the consistency check.

@dyrpsf
Copy link
Contributor Author

dyrpsf commented Feb 15, 2026

It's very helpful work! Thank you @dyrpsf The BioModels repository is struggling with the consistency check.

Thank you for the feedback and for explaining the BioModels use case! I’m glad this change helps with your consistency checks. If you run into any other issues or notice cases where the offline validator behaves unexpectedly, I’d be happy to look into follow‑up improvements.

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.

2 participants