Main components
SchemaValidatorPlugin: lifecycle (onEnable/onDisable) and startup orchestration.PluginConfig: reads config keys and resolves schema directory path.SchemaRegistry: case-insensitive schema storage and optional cache expiration.RegisteredSchemaMetadata: registration source, path, and timestamp for runtime schemas.FileSchemaLoader: JSON/YAML parsing, unsupported keyword detection, schema object construction.ValidationService: facade over validator dispatch and result assembly.ValidationMetrics: tracks built-in runtime validation counts and average timing.SchemaValidatorAPI: public Java/Bukkit facade for other plugins.SchemaValidatorCommand: command executor and tab completer for administrative usage.- Validators:
ObjectValidator,ArrayValidator,PrimitiveValidator, plusFormatValidatorhelper. - Optional Skript bridge:
SkriptSyntaxRegistration,EffValidateData,ExprLastValidationErrors,SkriptValidationBridge.
Runtime flow
- Plugin starts and loads
config.yml. - Registry and loader are initialized.
- Loader fail-fast mode mirrors
strict-mode. - If
auto-loadis true, schemas are scanned and registered. - Optional self-validation runs if
validation-on-loadis true. SchemaValidatorAPIcan serve programmatic requests as soon as the plugin is enabled.- Administrative commands are registered.
- If Skript is available, Skript syntax is registered.
- Skript validation requests also store the latest result in bridge state.
Data and schema boundaries
Schema loading boundary
- Accepts
.json,.yml,.yaml. - Unsupported non-
$keywords are warned or rejected (strict mode). definitionsand$defsare parsed during load.
Validation boundary
- Validation result is immutable (
ValidationResult,ValidationError). - Errors include path and detailed reason.
- Dispatch uses
SchemaTypeonly.
Java/Bukkit integration boundary
SchemaValidatorAPIresolves the plugin, registry, and validation service.- Programmatic callers receive results directly without using the Skript bridge.
- API-driven validations are tracked in runtime metrics.
Command integration boundary
- Commands query the same
SchemaRegistryused by startup, Skript, and the Java API. validate-fileparses JSON/YAML files directly and validates throughValidationService.reload <schemaName>andexportdepend on file-backed registration metadata.reload --allupdates schemas from the configured directory without wiping unrelated registered schemas.statsreflects only built-in tracked validation paths.
Skript integration boundary
- Effect accepts file paths as strings.
- Data loader parses to
Map<String, Object>root. - Expression reads only the latest bridge result (global mutable state).
Implementation notes
- Cache expiry in
SchemaRegistryis fixed at construction (5 minutesin plugin startup). - All major JSON Schema keywords are now supported and enforced. Test coverage: 373 unit tests passing across 23 validator test classes.
Related pages
- Runtime rule order and errors: Validation behavior
- Keyword support contract: Schema keywords
- Java/Bukkit integration details: Java API
- Administrative commands: Commands
- Skript API details: Skript API