Skip to content

Commit 7d94c54

Browse files
committed
Add Schema Tools documentation covering installation, diffing, validation, analysis, and type introspection. Update glossary and installation guide.
1 parent ce6dccd commit 7d94c54

11 files changed

Lines changed: 1794 additions & 4 deletions

File tree

CHANGELOG.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,51 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
66

77
---
88

9-
## [0.3.0] - 2026-01-07
9+
## [0.3.0] - 2026-01-08
1010

1111
### Added
1212

13+
#### Schema Tools Module (`aether-datafixers-schema-tools`)
14+
15+
New module for schema analysis, validation, and migration coverage checking.
16+
17+
**Schema Diffing (`schematools.diff`):**
18+
- `SchemaDiffer` — Fluent API for comparing two schemas
19+
- `SchemaDiff` — Immutable result with added/removed/common types
20+
- `TypeDiff` — Field-level changes for types present in both schemas
21+
- `FieldDiff` — Individual field change (ADDED, REMOVED, MODIFIED, UNCHANGED)
22+
- `DiffKind` — Enumeration of change types
23+
- Optional field-level diffing via `includeFieldLevel(true)`
24+
- Type filtering via `ignoreTypes(...)`
25+
26+
**Migration Analysis (`schematools.analysis`):**
27+
- `MigrationAnalyzer` — Fluent API for analyzing migration paths
28+
- `MigrationPath` — Complete migration sequence with all steps
29+
- `MigrationStep` — Single version transition with optional DataFix and SchemaDiff
30+
- `FixCoverage` — Analysis result showing fix coverage for schema changes
31+
- `CoverageGap` — Represents a schema change without corresponding DataFix
32+
- Coverage gap reasons: TYPE_ADDED, TYPE_REMOVED, TYPE_MODIFIED, FIELD_ADDED, FIELD_REMOVED, FIELD_TYPE_CHANGED
33+
- Orphan fix detection (fixes without schema changes)
34+
35+
**Schema Validation (`schematools.validation`):**
36+
- `SchemaValidator` — Fluent API for validating schemas
37+
- `ValidationResult` — Immutable collection of validation issues
38+
- `ValidationIssue` — Single issue with severity, code, message, location, context
39+
- `IssueSeverity` — ERROR, WARNING, INFO levels
40+
- `StructureValidator` — Validates schema structure (cycles, version ordering, parent chains)
41+
- `ConventionChecker` — Validates naming conventions for types, fields, classes
42+
- `ConventionRules` — Configurable naming rules (STRICT, RELAXED, NONE, or custom)
43+
- Predefined patterns for snake_case, camelCase, class suffixes
44+
- Custom validators via `customTypeValidator()` and `customFieldValidator()`
45+
46+
**Type Introspection (`schematools.introspection`):**
47+
- `TypeIntrospector` — Utility for analyzing type structures
48+
- `TypeStructure` — Normalized, comparable representation of a Type
49+
- `FieldInfo` — Field metadata (name, path, optionality, type)
50+
- `TypeKind` — Classification (PRIMITIVE, LIST, OPTIONAL, PRODUCT, SUM, FIELD, etc.)
51+
- Recursive field extraction with hierarchical paths
52+
- Structural equality comparison
53+
1354
#### CLI Module (`aether-datafixers-cli`)
1455

1556
New command-line interface for data migration without writing Java code.
@@ -47,6 +88,13 @@ New command-line interface for data migration without writing Java code.
4788
- `BootstrapLoadException` — Bootstrap class loading failures
4889
- `FormatParseException` — Input parsing failures
4990

91+
### Documentation
92+
93+
- Added comprehensive Schema Tools documentation (diffing, analysis, validation, introspection)
94+
- Added CLI module documentation (commands, format handlers, examples)
95+
- Updated glossary with Schema Tools terminology
96+
- Updated installation guide with new modules
97+
5098
---
5199

52100
## [0.2.0] - 2026-01-07

README.md

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ inspired by Minecraft's DataFixer Upper (DFU), with a focus on **simplicity**, *
1818
-**Codec System** — Bidirectional transformation between typed Java objects and dynamic representations
1919
-**Type Safety** — Strong typing with `TypeReference` identifiers for data routing
2020
-**Testkit** — Fluent test data builders, custom assertions, and test harnesses for DataFix testing
21+
-**CLI Tool** — Migrate and validate data files from the command line with batch processing
22+
-**Schema Tools** — Schema diffing, validation, migration analysis, and type introspection
2123
-**Migration Diagnostics** — Opt-in structured reports with timing, applied fixes, and snapshots
2224
-**Extended Rewrite Rules** — Batch operations, path-based transforms, conditional rules
2325
-**High-Performance APIs**`Rules.batch()` for single-pass multi-operation transforms
@@ -31,6 +33,8 @@ inspired by Minecraft's DataFixer Upper (DFU), with a focus on **simplicity**, *
3133
- **aether-datafixers-core** — Default implementations of the API interfaces
3234
- **aether-datafixers-codec** — Codec implementations for serialization formats
3335
- **aether-datafixers-testkit** — Testing utilities for DataFix, Schema, and migration testing
36+
- **aether-datafixers-cli** — Command-line interface for data migration and validation
37+
- **aether-datafixers-schema-tools** — Schema analysis, validation, diffing, and introspection
3438
- **aether-datafixers-examples** — Practical examples demonstrating real-world usage
3539
- **aether-datafixers-bom** — Bill of Materials for coordinated dependency management
3640

@@ -418,8 +422,10 @@ mvn test
418422
- **Performance optimizations** — Path caching, optimized fix registry, reduced allocations
419423

420424
- **v0.3.0** (next)
421-
- **CLI module** — Migrate files and print/export a migration report (batch-friendly)
422-
- **Schema tooling** — Runtime schema validation + diff utilities between versions
425+
- **CLI module** — Migrate files from the command line with batch processing and reports
426+
- **Schema Tools module** — Schema diffing, migration analysis, validation, and introspection
427+
- **Fix coverage analysis** — Detect schema changes without corresponding DataFixes
428+
- **Convention checking** — Enforce naming conventions for types, fields, and classes
423429

424430
- **v0.4.0**
425431
- **Spring Boot integration** — Auto-configuration for DataFixer in Spring apps

docs/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,16 @@ Migrate and validate data files from the command line:
9494
- [Format Handlers](cli/format-handlers.md) — Custom format handler development
9595
- [Examples](cli/examples.md) — Practical usage examples
9696

97+
### Schema Tools
98+
99+
Analyze, compare, and validate your schemas:
100+
101+
- [Schema Tools Overview](schema-tools/index.md) — Introduction to schema tooling
102+
- [Schema Diffing](schema-tools/schema-diffing.md) — Compare schemas and detect changes
103+
- [Migration Analysis](schema-tools/migration-analysis.md) — Analyze migration paths and fix coverage
104+
- [Schema Validation](schema-tools/schema-validation.md) — Validate structure and conventions
105+
- [Type Introspection](schema-tools/type-introspection.md) — Inspect type structures
106+
97107
### Advanced Topics
98108

99109
For experienced users:
@@ -121,6 +131,7 @@ For experienced users:
121131
| `aether-datafixers-codec` | GsonOps, JacksonOps implementations |
122132
| `aether-datafixers-cli` | Command-line interface for data migration |
123133
| `aether-datafixers-testkit` | Testing utilities for DataFix, Schema, and migration testing |
134+
| `aether-datafixers-schema-tools` | Schema analysis, validation, and diffing utilities |
124135
| `aether-datafixers-examples` | Practical usage examples |
125136
| `aether-datafixers-bom` | Bill of Materials for version management |
126137

docs/appendix/changelog.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,16 @@ History of documentation updates. For code changes, see the main [CHANGELOG.md](
66

77
## Version 0.3.0
88

9+
### New Section: Schema Tools Module
10+
11+
Added complete documentation for the new schema tools module:
12+
13+
- [Schema Tools Overview](../schema-tools/index.md) — Introduction, use cases, and quick start
14+
- [Schema Diffing](../schema-tools/schema-diffing.md) — Compare schemas and detect type/field changes
15+
- [Migration Analysis](../schema-tools/migration-analysis.md) — Analyze migration paths and fix coverage
16+
- [Schema Validation](../schema-tools/schema-validation.md) — Validate structure and naming conventions
17+
- [Type Introspection](../schema-tools/type-introspection.md) — Inspect type structures and extract field metadata
18+
919
### New Section: CLI Module
1020

1121
Added complete documentation for the new CLI module:
@@ -18,7 +28,7 @@ Added complete documentation for the new CLI module:
1828

1929
### Updated Pages
2030

21-
- [Main README](../README.md) — Added CLI module to navigation and module table
31+
- [Main README](../README.md) — Added CLI and Schema Tools to navigation and module table
2232
- [Installation Guide](../getting-started/installation.md) — Added CLI module to overview table
2333

2434
---

docs/appendix/glossary.md

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,68 @@ Terminology used in Aether Datafixers.
151151
**TypedAssert**
152152
: Custom AssertJ assertions for Typed objects (type and value checks).
153153

154+
## Schema Tools
155+
156+
**ConventionChecker**
157+
: Validates naming conventions for types, fields, and class names.
158+
159+
**ConventionRules**
160+
: Configurable naming rules for convention validation (STRICT, RELAXED, NONE, or custom).
161+
162+
**CoverageGap**
163+
: Represents a schema change without a corresponding DataFix.
164+
165+
**DiffKind**
166+
: Enumeration of change types: ADDED, REMOVED, MODIFIED, UNCHANGED.
167+
168+
**FieldDiff**
169+
: Represents a change to a single field between schema versions.
170+
171+
**FieldInfo**
172+
: Metadata about a field including name, path, optionality, and type.
173+
174+
**FixCoverage**
175+
: Analysis result showing which schema changes have corresponding DataFixes.
176+
177+
**IssueSeverity**
178+
: Validation issue severity levels: ERROR, WARNING, INFO.
179+
180+
**MigrationAnalyzer**
181+
: Entry point for analyzing migration paths and fix coverage between versions.
182+
183+
**MigrationPath**
184+
: Complete migration sequence containing all steps from source to target version.
185+
186+
**MigrationStep**
187+
: Single version transition in a migration path, with optional DataFix and SchemaDiff.
188+
189+
**SchemaDiff**
190+
: Result of comparing two schemas, containing added/removed types and field changes.
191+
192+
**SchemaDiffer**
193+
: Fluent API for comparing schemas and generating SchemaDiff results.
194+
195+
**SchemaValidator**
196+
: Fluent API for validating schema structure, conventions, and fix coverage.
197+
198+
**StructureValidator**
199+
: Validates schema structural integrity (cycles, version ordering, parent chains).
200+
201+
**TypeDiff**
202+
: Field-level changes for a specific type present in both compared schemas.
203+
204+
**TypeIntrospector**
205+
: Utility for analyzing type structure and extracting field information.
206+
207+
**TypeKind**
208+
: Classification of types: PRIMITIVE, LIST, OPTIONAL, PRODUCT, SUM, FIELD, etc.
209+
210+
**TypeStructure**
211+
: Normalized, comparable representation of a Type for analysis.
212+
213+
**ValidationIssue**
214+
: Single validation issue with severity, code, message, location, and context.
215+
216+
**ValidationResult**
217+
: Immutable collection of validation issues with filtering and status methods.
218+

docs/getting-started/installation.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Aether Datafixers is modular. Choose the modules you need:
1212
| `aether-datafixers-core` | Default implementations | Always needed for runtime |
1313
| `aether-datafixers-codec` | GsonOps, JacksonOps | When working with JSON |
1414
| `aether-datafixers-cli` | Command-line interface | For CLI-based data migration |
15+
| `aether-datafixers-schema-tools` | Schema analysis and validation | For CI/CD validation, diffing, coverage |
1516
| `aether-datafixers-testkit` | Testing utilities | For unit/integration testing |
1617
| `aether-datafixers-bom` | Version management | Recommended for multi-module projects |
1718

@@ -245,6 +246,21 @@ For command-line usage without writing Java code, see the dedicated CLI document
245246

246247
---
247248

249+
## Schema Tools Installation
250+
251+
For schema analysis, validation, and migration coverage checking:
252+
253+
```xml
254+
<dependency>
255+
<groupId>de.splatgames.aether.datafixers</groupId>
256+
<artifactId>aether-datafixers-schema-tools</artifactId>
257+
</dependency>
258+
```
259+
260+
[Schema Tools Overview](../schema-tools/index.md) — Learn about schema diffing, validation, and analysis
261+
262+
---
263+
248264
## Next Steps
249265

250266
Now that you have Aether Datafixers installed, proceed to:

docs/schema-tools/index.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Schema Tools
2+
3+
The **Aether Datafixers Schema Tools** module provides utilities for analyzing, comparing, validating, and introspecting schemas. It helps ensure migration completeness, detect schema changes, and enforce naming conventions.
4+
5+
## Overview
6+
7+
Schema Tools (`aether-datafixers-schema-tools`) is designed for:
8+
9+
- **Schema Diffing** — Compare two schemas to see what types and fields changed
10+
- **Migration Analysis** — Analyze migration paths and verify fix coverage
11+
- **Validation** — Validate schema structure and enforce naming conventions
12+
- **Introspection** — Inspect type structures and extract field metadata
13+
14+
## Quick Start
15+
16+
```java
17+
import de.splatgames.aether.datafixers.schematools.diff.SchemaDiffer;
18+
import de.splatgames.aether.datafixers.schematools.analysis.MigrationAnalyzer;
19+
import de.splatgames.aether.datafixers.schematools.validation.SchemaValidator;
20+
21+
// Compare two schemas
22+
SchemaDiff diff = SchemaDiffer.compare(schemaV1, schemaV2)
23+
.includeFieldLevel(true)
24+
.diff();
25+
26+
// Analyze migration path
27+
MigrationPath path = MigrationAnalyzer.forBootstrap(bootstrap)
28+
.from(100).to(200)
29+
.analyze();
30+
31+
// Validate schemas
32+
ValidationResult result = SchemaValidator.forBootstrap(bootstrap)
33+
.validateAll()
34+
.validate();
35+
```
36+
37+
## Module Contents
38+
39+
| Package | Description |
40+
|---------|-------------|
41+
| `schematools.diff` | Schema comparison and diff generation |
42+
| `schematools.analysis` | Migration path analysis and fix coverage |
43+
| `schematools.validation` | Schema validation and convention checking |
44+
| `schematools.introspection` | Type structure inspection and field extraction |
45+
46+
## Installation
47+
48+
Add schema-tools as a dependency:
49+
50+
**Maven:**
51+
```xml
52+
<dependency>
53+
<groupId>de.splatgames.aether.datafixers</groupId>
54+
<artifactId>aether-datafixers-schema-tools</artifactId>
55+
</dependency>
56+
```
57+
58+
**Gradle:**
59+
```groovy
60+
implementation 'de.splatgames.aether.datafixers:aether-datafixers-schema-tools'
61+
```
62+
63+
## Use Cases
64+
65+
### Pre-Release Validation
66+
67+
Before releasing a new version, validate that all schema changes have corresponding DataFixes:
68+
69+
```java
70+
FixCoverage coverage = MigrationAnalyzer.forBootstrap(bootstrap)
71+
.from(oldVersion)
72+
.to(newVersion)
73+
.analyzeCoverage();
74+
75+
if (!coverage.isFullyCovered()) {
76+
for (CoverageGap gap : coverage.gaps()) {
77+
System.err.println("Missing fix: " + gap.type() + " - " + gap.reason());
78+
}
79+
throw new IllegalStateException("Not all schema changes are covered by fixes!");
80+
}
81+
```
82+
83+
### CI/CD Integration
84+
85+
Integrate schema validation into your build pipeline:
86+
87+
```java
88+
ValidationResult result = SchemaValidator.forBootstrap(bootstrap)
89+
.validateStructure()
90+
.validateConventions()
91+
.withConventions(ConventionRules.STRICT)
92+
.validate();
93+
94+
if (!result.isValid()) {
95+
result.errors().forEach(error ->
96+
System.err.println("[ERROR] " + error.code() + ": " + error.message())
97+
);
98+
System.exit(1);
99+
}
100+
```
101+
102+
### Schema Change Documentation
103+
104+
Generate documentation of schema changes between versions:
105+
106+
```java
107+
SchemaDiff diff = SchemaDiffer.compare(schemaV1, schemaV2)
108+
.includeFieldLevel(true)
109+
.diff();
110+
111+
System.out.println("Schema Changes V1 -> V2:");
112+
System.out.println(" Added types: " + diff.addedTypes());
113+
System.out.println(" Removed types: " + diff.removedTypes());
114+
115+
for (TypeDiff typeDiff : diff.typeDiffs().values()) {
116+
System.out.println(" " + typeDiff.reference().name() + ":");
117+
typeDiff.addedFields().forEach(f ->
118+
System.out.println(" + " + f.fieldName()));
119+
typeDiff.removedFields().forEach(f ->
120+
System.out.println(" - " + f.fieldName()));
121+
}
122+
```
123+
124+
---
125+
126+
## In This Section
127+
128+
- [Schema Diffing](schema-diffing.md) — Compare schemas and detect changes
129+
- [Migration Analysis](migration-analysis.md) — Analyze migration paths and fix coverage
130+
- [Schema Validation](schema-validation.md) — Validate structure and conventions
131+
- [Type Introspection](type-introspection.md) — Inspect type structures
132+
133+
---
134+
135+
## Next Steps
136+
137+
[Schema Diffing](schema-diffing.md) — Learn how to compare schemas

0 commit comments

Comments
 (0)