Browse Source

playing with an "all in one" function

master
Cerys 5 months ago
parent
commit
49cde28214
  1. 9
      src/SchemaBuilder/SchemaBuilder.php

9
src/SchemaBuilder/SchemaBuilder.php

@ -5,6 +5,7 @@ namespace Darksparrow\AuxiliumSchemaBuilder\SchemaBuilder;
use Darksparrow\AuxiliumSchemaBuilder\Exceptions\SchemaNameUnsetException;
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocument;
use Darksparrow\AuxiliumSchemaBuilder\Attributes\SchemaDocumentField;
use JetBrains\PhpStorm\NoReturn;
use ReflectionClass;
class SchemaBuilder
@ -107,4 +108,12 @@ class SchemaBuilder
return $schema;
}
#[NoReturn] public static function RenderSchema(object $targetSchema): void
{
$result = self::GenerateSchema(new $targetSchema());
header('Content-Type: application/json');
echo json_encode($result, JSON_PRETTY_PRINT);
die();
}
}

Loading…
Cancel
Save