This is the C++ GDExtension implementation of the GDSchema plugin. It provides a full JSON Schema Draft-7 validation plugin for Godot 4.3 and later.
- 1.3.0 (Current) - Improved meta-schema handling, added
get_id,get_title,get_description, andget_commentmethods to theSchema class, and theSchema.get_schema_from_registrystatic method - 1.2.2 - Added support for Android (arm64, x86_64) platforms
- 1.2.1 - Updated documentation
- 1.2.0 - Added
Schema.load_jsonandSchema.load_json_filemethods, and fixed schema meta validation - 1.1.0 - Enabled storing custom data in
ValidationContext, and support for external implementations of the"default"keyword - 1.0.0 - Initial public release
var schema = Schema.build_schema({
"type": "object",
"properties": {
"username": {"type": "string", "minLength": 3},
"age": {"type": "integer", "minimum": 0}
},
"required": ["username"]
})
# Valid data
var result = schema.validate({
"username": "alice",
"age": 25
})
print(result.is_valid()) # true
# Invalid data
result = schema.validate({
"username": "ab",
"age": -5
})
if result.has_errors():
print(result.get_summary())
# Schema validation failed with 2 error(s):
# [1] At '/username': String length 2 is less than minimum 3 (minLength)
# [2] At '/age': Value -5 is less than minimum 0 (minimum)📌 For full usage details and API documentation, see the plugin README:
📂 project/addons/GDSchema/README.md
- 📏 Full JSON Schema Draft-7: All validation keywords supported, including
type,minimum,maxLength,pattern,required,enum, and logical composition (allOf,oneOf,anyOf,not) - 🗂️ Schema Registry: Schemas with
$idare auto-registered and can be referenced across documents with$ref - 🔍 Rich Validation Errors: Detailed error messages with JSON Pointer paths, violated constraints, and invalid values
- 🧩 Editor Integration: Navigate schema trees, retrieve child nodes, and inspect definitions for editor auto-complete and tooling
- 🛡️ Thread-Safe and Lazy: Schemas compile lazily with caching for performance and thread safety
- ✅ Comprehensive Results: Validation returns a
SchemaValidationResultwith all errors collected at once
GDSchema is available on the Godot Asset Library. Be sure to enable the plugin in your project settings after installing.
Alternatively you can build the binaries yourself. For the latest versions of macOS this may be necessary.
- Git (for cloning and submodules)
- Python 3.x (for SCons build system)
- C++ compiler with C++17 support:
- Windows: Visual Studio 2022 with C++ workload
- Linux/macOS: GCC 9+ or Clang 10+
- SCons build system (
pip install scons) - Android: JDK version 20 and NDK version 23.2.8568313
# Clone with submodules
git clone --recursive https://github.com/fimbul-works/GDSchema
# Or if already cloned, initialize submodules
git submodule update --init --recursive# Debug build
scons target=template_debug
# Release build
scons target=template_release
# Specify platform (default is platform-dependent)
scons platform=windows target=template_release
scons platform=linux target=template_releaseplatform: Target (windows,linux,macos,android, etc.)target: Build type (template_debug,template_release)arch: CPU architecture (x86_32,x86_64,arm64, etc.)dev_build: Enable extra debugging (yes/no)use_llvm: Use Clang/LLVM compiler (yes/no)verbose: Verbose build output (yes/no)
- Windows: ✅ Prebuilt binaries available for x86 64-bit architecture.
- Linux: ✅ Prebuilt binaries available for x86 64-bit architecture.
- macOS:
⚠️ Prebuilt binaries available for universal architecture.- Note: Some macOS configurations (particularly newer versions with stricter Gatekeeper policies) may prevent loading of GDExtensions generally, not just this plugin. If the extension fails to load, try building from source or test with other GDExtensions to determine if this is a system-wide issue.
- Android: ✅ Prebuilt binaries available for ARM 64-bit and x86 64-bit architectures.
- Follow Godot's API design patterns.
- Thread safety: No global state; ensure safe multithreading.
- Write tests: Every new feature should have test coverage. See the test suite in the project folder.
- Document your changes: All public APIs must be documented.
MIT License (see LICENSE file for details).
Built with ✅ by FimbulWorks