Validation Architecture
The validation system is built around Info Generators that scan projects and produce Info Items:app/src/info/ProjectInfoSet.ts:1
Info Generators
Info generators implement theIProjectInfoGenerator interface and scan projects for specific issues.
Generator Types
Project Generators
Scan entire projects (all files)Interface:
IProjectInfoGeneratorItem Generators
Scan individual ProjectItemsInterface:
IProjectItemInfoGeneratorFile Generators
Scan individual filesInterface:
IProjectFileInfoGeneratorBuilt-in Generators
The framework includes many built-in validators:SchemaItemInfoGenerator
SchemaItemInfoGenerator
Validates JSON files against their schemas.What it checks:Reference:
- JSON structure matches schema definitions
- Required properties are present
- Data types are correct
app/src/info/SchemaItemInfoGenerator.ts:1ScriptModuleManager
ScriptModuleManager
Ensures script modules are up to date.What it checks:
- Module versions in manifest.json
- Package.json dependencies
- Beta API module versions
- Outdated module versions
- Package.json dependencies
app/src/manager/ScriptModuleManager.ts:1BaseGameVersionManager
BaseGameVersionManager
Scans for outdated base game versions.What it checks:
- World template base_game_version
- Comparison with latest Minecraft release
- base_game_version to latest
app/src/manager/BaseGameVersionManager.ts:1BehaviorPackEntityTypeManager
BehaviorPackEntityTypeManager
Validates behavior pack entity type files.What it checks:
- Entity format_version is current
- Entity structure is valid
- Smart format version upgrades
- Semantic compatibility maintenance
CheckManifestGenerator
CheckManifestGenerator
Validates manifest.json files.What it checks:
- Required manifest fields
- Valid UUIDs
- Version format
- Dependencies
CheckForbiddenFiles
CheckForbiddenFiles
Checks for files that shouldn’t be in add-ons.What it checks:
- Build artifacts (node_modules, dist, lib)
- Development files (.env, *.mjs)
- Configuration files (package-lock.json)
app/src/info/projectGenerators/CheckForbiddenFiles.tsInfo Items
Validation results are returned asProjectInfoItem objects:
Item Types
Info Item Structure
Running Validation
Basic Validation
Validation Suites
Different validation suites for different scenarios:defaultInDevelopment
All validators except cooperative add-on and sharing checks.Use for: Local development
cooperativeAddOn
Validates add-ons for marketplace submission.Use for: Marketplace preparation
sharing
Checks for sharing compatibility.Use for: Community sharing
sharingStrict
Stricter sharing validation.Use for: Wide distribution
Managers: Generators + Updaters
A Manager is an info generator that can also fix issues it finds:Example: ScriptModuleManager
Creating a Custom Manager
Automated Updates
TheProjectUpdateRunner orchestrates automated fixes:
Update Flow
Practical Examples
Example 1: Validate Before Export
Example 2: Auto-fix Common Issues
Example 3: Custom Validation Report
Best Practices
Run validation frequently
Validate during development to catch issues early.
Use appropriate suites
Choose the right validation suite for your use case.
Handle errors gracefully
Always check for validation errors before operations.
Keep modules updated
Use managers to keep dependencies current.
Troubleshooting
Validation takes too long
Validation takes too long
Some validators are expensive. Consider:
- Using specific validation suites instead of all
- Excluding certain tests with
_excludeTests - Running validation in background workers
False positives
False positives
If a validator reports incorrect issues:
- Check that project files are loaded (
await item.loadContent()) - Ensure schemas are up to date
- Review the specific generator implementation
Updates fail to apply
Updates fail to apply
If automated updates don’t work:
- Check file permissions
- Ensure project is saved after updates
- Verify the updater supports your file structure
Related Resources
- Project Structure - Understanding the project model
- Testing Locally - Testing with local servers
- Packaging Add-ons - Export validation