scedel / schema
Typed schema repository builder for Scedel
Installs: 6
Dependents: 2
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
pkg:composer/scedel/schema
Requires
- php: ^8.3
- scedel/parser: *
Requires (Dev)
- phpunit/phpunit: ^13.0
This package is auto-updated.
Last update: 2026-02-18 16:36:33 UTC
README
Intermediate layer between scedel/parser AST and downstream packages (validator/codegen).
RFC support
What it provides
- Recursive include loading (DFS include-first)
- Include cycle detection
- Diamond include graphs (shared canonical targets are loaded once)
- Warnings for direct duplicate includes in a single file
- Type merge (
type expr+ annotation-only declarations) - Validator merge by
(targetType, name)with strict structural duplicate checks - Immutable
SchemaRepositorywith types, validators, annotation trees, and document include graph
Usage
use Scedel\Parser\ParserService; use Scedel\Schema\Infrastructure\FilesystemIncludeResolver; use Scedel\Schema\Infrastructure\FilesystemSourceLoader; use Scedel\Schema\RepositoryBuilder; $builder = new RepositoryBuilder( new ParserService(), new FilesystemIncludeResolver(), new FilesystemSourceLoader(), ); $repository = $builder->buildFromFile('/absolute/path/schema.scedel'); $type = $repository->getType('Post'); $validator = $repository->getValidator('String', 'noAds');
buildFromString() supports includes if baseUri is provided.
$repository = $builder->buildFromString( $source, 'inline.scedel', 'file:///absolute/path/inline.scedel', );
Schema info utility
Print human-readable schema info (version, documents/includes, types with constraints, validators, annotations):
php bin/describe-schema.php /absolute/path/schema.scedel
Include builtin types/validators in output:
php bin/describe-schema.php --show-builtins /absolute/path/schema.scedel