Skip to content

Commit

Permalink
Merge pull request #4 from topcoder1406/feature/fix-json-schema-gener…
Browse files Browse the repository at this point in the history
…ator

fixed json schema generator
  • Loading branch information
SavKS authored Jun 8, 2023
2 parents 827c5be + c759ca5 commit eb13b11
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/TypeGeneration/JsonSchema/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public function generate(): ?array
return $this->processType($this->type);
}

protected function processType(Type|Types $type): array|stdClass|null
protected function processType(Type|Types $type): ?array
{
return match (true) {
$type instanceof Types => $this->processTypes($type),

$type instanceof ConstRecordType => $this->processConstRecord($type),
$type instanceof AnyType => new stdClass,
$type instanceof AnyType => [ 'type' => 'any' ],
$type instanceof BooleanType => [ 'type' => 'boolean' ],
$type instanceof ConstBooleanType => [ 'type' => 'boolean', 'enum' => [ $type->value ] ],
$type instanceof StringType => [ 'type' => 'string' ],
Expand Down Expand Up @@ -80,7 +80,7 @@ protected function processTypes(Types $type): array
$this->processType(...),
$type->types
),
fn (array|stdClass|null $schema) => $schema !== null
fn (?array $schema) => $schema !== null
);

if (
Expand Down

0 comments on commit eb13b11

Please sign in to comment.