X.Justiz.Core

SDK Generation Workflow

[!TIP]
🌐 Deutsche Version hier verfΓΌgbar πŸ‘ˆ

This document explains how cross-language SDK consistency is maintained in this open-source project.

Overview

The .NET project is the source of truth for all models. The Java SDK models are manually maintained and verified against the generated JSON Schema to ensure parity.

.NET Models β†’ JSON Schema
                    ↓
         Parity Tests Verify Java Matches

How It Works

1. Schema Generation

When .NET models change, the XsdGenerator project regenerates:

2. Java SDK

The Java models are manually crafted in sdk/java/src/main/java/de/xjustiz/core/models/.

Automated parity tests verify that Java models:

3. Parity Verification

The pipeline runs:

If any discrepancy is found, the pipeline fails.

For Contributors

Changing .NET Models

  1. Modify .NET models in sdk/dotnet/src/xjustiz.core-dotnet/Models/
  2. Push your changes
  3. The pipeline regenerates the JSON Schema
  4. Manually update the corresponding Java models if needed
  5. Parity tests will fail if Java models don’t match

Syncing Java Models from .NET

Use the sync script to automatically update Java models based on .NET models:

python scripts/sync-java-models.py

The script will:

Running Parity Tests Locally

# Java parity tests (via Gradle)
cd sdk/java && gradle test --tests "*SchemaParityTest*"

Directory Structure

X.Justiz.Core/
β”œβ”€β”€ sdk/dotnet/src/xjustiz.core-dotnet/    # Source of Truth
β”‚   └── Models/                          # .NET models (edit here)
β”œβ”€β”€ schemas/
β”‚   └── xjustiz-core.schema.json        # Generated from .NET
β”œβ”€β”€ sdk/java/src/main/java/de/xjustiz/core/
β”‚   β”œβ”€β”€ models/                          # Java models (synced from .NET)
β”‚   └── serialization/                   # Hand-written utilities
└── scripts/
    └── sync-java-models.py              # Sync Java models from .NET

See Also