API reference / Quittio \ Core \ Serialization
JsonSchemaGenerator
final class in quittio/core
Quittio\Core\Serialization\JsonSchemaGenerator · Source
Generates the JSON Schema (draft 2020-12) of InvoiceData::toArray() from the constructor signatures and mapping attributes, so that the schema never drifts from the model.
Constants#
| Constant | Value | Description |
|---|---|---|
SCHEMA_ID | 'https://quittio.dev/schema/invoice.schema.json' |
Methods#
| Method | Description |
|---|---|
::defaultPath() | Path of the shipped schema (resources/schema/invoice.schema.json of the core package), which JsonSchemaValidator validates against. |
->generate() | |
->toJson() | The schema of generate() as pretty-printed JSON with a trailing newline, as stored in the shipped file. |
defaultPath()#
public static function defaultPath(): stringPath of the shipped schema (resources/schema/invoice.schema.json of the core package), which JsonSchemaValidator validates against.
- Returns
string
generate()#
public function generate(): array<string, mixed>- Returns
array<string, mixed>
toJson()#
public function toJson(): stringThe schema of generate() as pretty-printed JSON with a trailing newline, as stored in the shipped file.
- Returns
string