Something went wrong. Try again.
Parse and validate AT Protocol Lexicons with DTO generation for Laravel
Something went wrong. Try again.
1.3 kB · 60 lines
PHP
at dev
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061<?php
use SocialDept\AtpSchema\Data\LexiconDocument;use SocialDept\AtpSchema\Facades\Schema;
if (! function_exists('schema')) { /** * Get the SchemaManager instance or load a schema. * * @return \SocialDept\AtpSchema\SchemaManager|LexiconDocument */ function schema(?string $nsid = null) { if ($nsid === null) { return app('schema'); }
return Schema::load($nsid); }}
if (! function_exists('schema_find')) { /** * Find a schema by NSID (nullable version). */ function schema_find(string $nsid): ?LexiconDocument { return Schema::find($nsid); }}
if (! function_exists('schema_exists')) { /** * Check if a schema exists. */ function schema_exists(string $nsid): bool { return Schema::exists($nsid); }}
if (! function_exists('schema_validate')) { /** * Validate data against a schema. */ function schema_validate(string $nsid, array $data): bool { return Schema::validate($nsid, $data); }}
if (! function_exists('schema_generate')) { /** * Generate DTO code from a schema. */ function schema_generate(string $nsid, ?string $outputPath = null): string { return Schema::generate($nsid, $outputPath); }}