The Xeto SDK family lets you load, validate, traverse, and serialize Xeto libraries and specs
directly in your language of choice. Parse typed ontologies, resolve dependency graphs, and query
specs — all from native code. SDKs are currently in development and will be released alongside
the xeto.dev registry launch.
// Load a library and query specsimportdev.xeto.sdk.*;
XetoEnv env = XetoEnv.load("project-haystack:3.9.13");
XetoLib lib = env.lib("project-haystack");
// Iterate all specs
lib.specs().each(spec -> {
System.out.println(spec.name() + " extends " + spec.base());
});
// Validate data against a specDict site = Dict.of("dis", "Main Campus", "tz", "New_York");
env.validate(lib.spec("Site"), site);
Method
Description
XetoEnv.load(libRef)
Load a library and its full dependency graph
env.lib(name)
Get a loaded library by name
lib.specs()
Iterate all top-level specs in the library
lib.spec(name)
Look up a spec by name
env.validate(spec, data)
Validate a Dict against a spec, returns ValidationResult
spec.slots()
List all slot definitions on a spec
🐍
Python SDK
Lightweight Xeto library for Python 3.10+
v0.2.1-alphaComing Soon
pip install xeto-python
fromxetoimport XetoEnv
# Load library from registry
env = XetoEnv.load("project-haystack:3.9.13")
lib = env.lib("project-haystack")
# List all spec namesfor spec in lib.specs():
print(f"{spec.name} extends {spec.base}")
# Validate a dict against the Site spec
site_data = {"dis": "Main Campus", "tz": "America/New_York"}
result = env.validate("Site", site_data)
if result.is_valid:
print("Valid site!")
Method
Description
XetoEnv.load(lib_ref)
Load a library by name and version string
env.lib(name)
Get a library object by name
lib.specs()
Returns an iterable of Spec objects
env.validate(spec_name, data)
Validate a dict against a named spec
spec.slots
Dict of slot name → SlotDef
🟨
JavaScript SDK
Browser and Node.js compatible Xeto runtime
v0.3.0-alphaComing Soon
npm install @xeto/sdk
import { XetoEnv } from'@xeto/sdk';
// Load library (async — fetches from registry)const env = awaitXetoEnv.load('project-haystack:3.9.13');
const lib = env.lib('project-haystack');
// Get a spec and inspect its slotsconst site = lib.spec('Site');
site.slots().forEach(slot => {
console.log(`${slot.name}: ${slot.type}`);
});
// Validate dataconst result = env.validate('Site', { dis: 'HQ', tz: 'UTC' });
console.log(result.valid); // true
Method
Description
XetoEnv.load(libRef)
Async — fetches and loads a library from the registry
env.lib(name)
Get a loaded library instance
lib.spec(name)
Look up a spec by name, returns Spec | null
spec.slots()
Returns array of SlotDef objects
env.validate(specName, data)
Validate a plain object against a spec
🔷
TypeScript SDK
Fully typed Xeto client with generated type definitions
v0.3.0-alphaComing Soon
npm install @xeto/sdk
# TypeScript types are bundled — no @types package needed
import { XetoEnv, Spec, SlotDef, ValidationResult } from'@xeto/sdk';
// Full TypeScript types on all SDK objectsconst env: XetoEnv = awaitXetoEnv.load('project-haystack:3.9.13');
const spec: Spec = env.lib('project-haystack').spec('Site')!;
// Generate TypeScript interfaces from specs:// xeto codegen --lib project-haystack --out ./types/// Example generated output:interfaceSite {
dis: string;
geoAddr?: string;
area?: number;
tz: string;
}
✦ TypeScript Codegen — The TS SDK includes a code generator that produces native
TypeScript interfaces from any Xeto spec library, so your data models stay in sync with the
registry automatically.
⌨️
CLI Tool
Install, validate, and manage Xeto libraries from the terminal
Coming Soon
# Install the CLInpm install -g @xeto/cli
# Install a libraryxeto install project-haystack
# Search the registryxeto search "building automation"# Validate a xeto filexeto validate ./my-library.xeto
# Publish a libraryxeto publish
# Generate TypeScript types from a spec libraryxeto codegen --lib project-haystack --lang ts --out ./types/