Skip to content

feat: prepare the datex4j 0.1.0 release foundation - #41

Merged
juherr merged 2 commits into
mainfrom
feat/prepare-0.1.0-release
Jul 25, 2026
Merged

feat: prepare the datex4j 0.1.0 release foundation#41
juherr merged 2 commits into
mainfrom
feat/prepare-0.1.0-release

Conversation

@juherr

@juherr juherr commented Jul 25, 2026

Copy link
Copy Markdown
Owner

Summary

  • adopt Java 21 as the consumer baseline and test Java 21/25 in CI
  • isolate generated model dependencies and add a single-model consumer test
  • harden XML unmarshalling and validation against DTD, XXE, external access, and entity expansion
  • remove direct JSON coupling to generated v3.6/v3.7 multilingual-string classes
  • cache JAXB contexts and compiled schemas by provider classloader
  • enforce 85% line coverage for the XML and validation modules
  • update architecture, compatibility, contribution, and release documentation

Why

The current dependency graph makes lightweight model selection unreliable, while JAXB and validation accept XML parser features that are unsafe for untrusted feeds. The first public release also needs an explicit Java baseline, measurable coverage gates, and a reproducible consumer-level dependency check.

Impact

Consumers can install one DATEX II model version without resolving the full model aggregate. XML processing rejects dangerous document constructs before JAXB or schema validation. Existing typed facade methods remain available, while missing JSON model artifacts now produce explicit diagnostics.

Validation

  • ./mvnw clean verify
  • 254 tests passed; 5 opt-in tests skipped
  • XML line coverage: 85.3%
  • validation line coverage: 85.5%
  • release-profile package build with signing disabled
  • standalone Maven dependency tree with XML and only model v3.7
  • GitHub Actions YAML parsing
  • git diff --check

fix #9
fix #10
fix #11
fix #13

Refs #12
Refs #18

Summary by CodeRabbit

  • New Features

    • Added support for selecting DATEX II model versions through matching runtime artifacts.
    • Added secure XML parsing that rejects DTDs, external entities, and recursive entity expansion.
    • Added compatibility for Java 21 and newer, with verification on Java 21 and 25.
  • Bug Fixes

    • Improved handling and reporting of malformed XML, input errors, and validation failures.
    • Improved JSON handling across supported DATEX II model versions.
  • Performance

    • Reused JAXB contexts and compiled schemas to reduce repeated initialization.
  • Documentation

    • Updated compatibility, version-selection, architecture, and contribution guidance.

@juherr
juherr marked this pull request as ready for review July 25, 2026 12:36
@juherr

juherr commented Jul 25, 2026

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Jul 25, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: fd77a92f-f87f-4d25-bf1c-6fe5451a2464

📥 Commits

Reviewing files that changed from the base of the PR and between edb3f93 and 7303fb0.

📒 Files selected for processing (5)
  • .github/workflows/ci.yml
  • datex4j-validation/src/main/java/dev/juherr/datex4j/validation/DatexValidator.java
  • datex4j-validation/src/test/java/dev/juherr/datex4j/validation/DatexValidatorTest.java
  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java
  • docs/guides/models-and-versions.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • .github/workflows/ci.yml
  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java
  • datex4j-validation/src/main/java/dev/juherr/datex4j/validation/DatexValidator.java

📝 Walkthrough

Walkthrough

The PR adopts Java 21, verifies Java 21/25 in CI, isolates versioned model dependencies, adds consumer classpath tests, makes JSON model handling version-neutral, hardens XML parsing and validation, caches JAXB contexts and schemas, and updates documentation and coverage checks.

Changes

Build and consumer classpath

Layer / File(s) Summary
Java baseline and model isolation
.github/workflows/ci.yml, pom.xml, datex4j-consumer-tests/..., datex4j-*/pom.xml
The build targets Java 21, CI runs on Java 21 and 25, version-specific model artifacts are used, and consumer tests verify single-model classpaths and unavailable-version failures.

Version-neutral JSON model handling

Layer / File(s) Summary
Reflective JSON model integration
datex4j-json/src/main/java/..., datex4j-json/src/test/java/...
JSON multilingual string serialization, deserialization, and registration now resolve types from the configured model version through reflection.

Secure XML processing and runtime caches

Layer / File(s) Summary
Secure parsing, caching, and validation
datex4j-xml/..., datex4j-validation/...
XML reading and validation reject DTD/entity access, preserve parsing failures, reuse JAXB contexts and schemas, and add coverage, cache, security, input-contract, and validation tests.

Toolchain and architecture documentation

Layer / File(s) Summary
Documentation and local toolchain alignment
README.md, CONTRIBUTING.md, docs/..., CHANGELOG.md, mise.toml
Documentation and local Java provisioning now describe Java 21, explicit model selection, facade boundaries, consumer verification, and hardened XML behavior.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant JaxbDatexMarshaller
  participant SecureXmlSource
  participant DatexValidator
  Client->>JaxbDatexMarshaller: read XML InputStream
  JaxbDatexMarshaller->>SecureXmlSource: create hardened SAXSource
  SecureXmlSource-->>JaxbDatexMarshaller: return protected XML source
  Client->>DatexValidator: validate XML InputStream
  DatexValidator->>SecureXmlSource: create hardened SAXSource
  SecureXmlSource-->>DatexValidator: return protected XML source
  DatexValidator-->>Client: return validation result or exception
Loading

Possibly related issues

  • #14 — Consumer classpath tests and explicit model-version dependencies support clean resolution of one selected model version.

Poem

A rabbit reviews Java bright,
With model paths tucked just right.
DTDs are shown the door,
Cached schemas hop ashore,
And CI checks two JDKs tonight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 8.89% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the release-prep focus, though it is broader than the concrete technical changes.
Linked Issues check ✅ Passed The PR appears to satisfy [#9, #10, #11, #13] with XML hardening, Java 21/25 CI, model isolation, and JaCoCo gates.
Out of Scope Changes check ✅ Passed No clear out-of-scope code changes are evident; the added docs, tests, and build updates align with the linked objectives.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/prepare-0.1.0-release

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java (1)

1-56: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

Consolidate the duplicated fail-closed XML source factory. SecureXmlSource and SecureValidationSource are byte-for-byte identical (same feature URIs, same EntityResolver, same from(InputStream) contract), and datex4j-validation already depends on datex4j-xml (DatexValidator builds its marshaller via DatexXml.builder()). Keeping two independent copies of this XXE/DTD hardening logic risks the two configurations drifting apart if a future mitigation is added to only one of them.

  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java: make this the single shared implementation (e.g., expose from(InputStream) publicly, or move the class to a shared internal package consumable by datex4j-validation).
  • datex4j-validation/src/main/java/dev/juherr/datex4j/validation/SecureValidationSource.java: remove this duplicate and delegate to datex4j-xml's SecureXmlSource.from(...) instead.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java` around
lines 1 - 56, Consolidate the duplicated fail-closed XML source implementation:
in datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java, expose
SecureXmlSource.from(InputStream) for cross-module use; in
datex4j-validation/src/main/java/dev/juherr/datex4j/validation/SecureValidationSource.java,
remove the duplicate feature configuration and delegate callers to
SecureXmlSource.from(...), preserving the existing contract and hardening
behavior.
🧹 Nitpick comments (1)
.github/workflows/ci.yml (1)

26-26: 🔒 Security & Privacy | 🔵 Trivial | ⚡ Quick win

Disable persisted checkout credentials.

No later step needs authenticated Git operations. Add persist-credentials: false to reduce unnecessary token exposure; this also addresses the reported zizmor warning. (github.com)

[details]

       - name: Checkout
         uses: actions/checkout@... 
+        with:
+          persist-credentials: false

[/details]

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/ci.yml at line 26, Update the actions/checkout step to set
persist-credentials to false, keeping the existing pinned revision and version
comment unchanged.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 17-23: Update the JaCoCo upload step in the CI workflow to use a
matrix-specific artifact name, jacoco-reports-java-${{ matrix.java }}, so each
Java matrix leg uploads a unique artifact.

In `@docs/guides/models-and-versions.md`:
- Around line 14-15: Update the sentence describing the XML and validation
facades to remove the duplicated “XML”, leaving exactly one “XML” before “and
validation facades”.

---

Outside diff comments:
In `@datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java`:
- Around line 1-56: Consolidate the duplicated fail-closed XML source
implementation: in
datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java, expose
SecureXmlSource.from(InputStream) for cross-module use; in
datex4j-validation/src/main/java/dev/juherr/datex4j/validation/SecureValidationSource.java,
remove the duplicate feature configuration and delegate callers to
SecureXmlSource.from(...), preserving the existing contract and hardening
behavior.

---

Nitpick comments:
In @.github/workflows/ci.yml:
- Line 26: Update the actions/checkout step to set persist-credentials to false,
keeping the existing pinned revision and version comment unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 72e9bbf1-da5f-4b0c-b4c5-b47cd3dd2c36

📥 Commits

Reviewing files that changed from the base of the PR and between 53b713b and edb3f93.

📒 Files selected for processing (40)
  • .github/workflows/ci.yml
  • CHANGELOG.md
  • CONTRIBUTING.md
  • README.md
  • datex4j-builders/pom.xml
  • datex4j-consumer-tests/pom.xml
  • datex4j-consumer-tests/src/test/java/dev/juherr/datex4j/consumer/SingleModelClasspathTest.java
  • datex4j-domain-evcharging/pom.xml
  • datex4j-domain-parking/pom.xml
  • datex4j-domain-srti/pom.xml
  • datex4j-domain-traffic/pom.xml
  • datex4j-domain-uvar/pom.xml
  • datex4j-integration-tests/pom.xml
  • datex4j-json/pom.xml
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/DatexJson.java
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/DatexJsonMapper.java
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/internal/DatexJsonModule.java
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/internal/MultilingualString36Json.java
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/internal/MultilingualStringJson.java
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/internal/package-info.java
  • datex4j-json/src/test/java/dev/juherr/datex4j/json/internal/MultilingualStringJsonTest.java
  • datex4j-location/pom.xml
  • datex4j-ocpi/pom.xml
  • datex4j-validation/pom.xml
  • datex4j-validation/src/main/java/dev/juherr/datex4j/validation/DatexValidator.java
  • datex4j-validation/src/main/java/dev/juherr/datex4j/validation/SecureValidationSource.java
  • datex4j-validation/src/test/java/dev/juherr/datex4j/validation/DatexValidatorTest.java
  • datex4j-validation/src/test/java/dev/juherr/datex4j/validation/ValidationResultTest.java
  • datex4j-xml/pom.xml
  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/ClasspathSchemas.java
  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/JaxbContexts.java
  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/JaxbDatexMarshaller.java
  • datex4j-xml/src/main/java/dev/juherr/datex4j/xml/SecureXmlSource.java
  • datex4j-xml/src/test/java/dev/juherr/datex4j/xml/DatexRoundtripTest.java
  • datex4j-xml/src/test/java/dev/juherr/datex4j/xml/DatexRuntimeCacheTest.java
  • datex4j-xml/src/test/java/dev/juherr/datex4j/xml/DatexXmlSecurityTest.java
  • docs/architecture.md
  • docs/guides/models-and-versions.md
  • mise.toml
  • pom.xml
💤 Files with no reviewable changes (1)
  • datex4j-json/src/main/java/dev/juherr/datex4j/json/internal/MultilingualString36Json.java

Comment thread .github/workflows/ci.yml
Comment thread docs/guides/models-and-versions.md Outdated
@juherr
juherr merged commit 80e797c into main Jul 25, 2026
6 checks passed
@juherr
juherr deleted the feat/prepare-0.1.0-release branch July 25, 2026 12:58
juherr added a commit that referenced this pull request Jul 25, 2026
feat: prepare the datex4j 0.1.0 release foundation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant