Skip to content

Commit

Permalink
fix proxy schema generator
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskapp committed Sep 8, 2023
1 parent d52ad02 commit 401005e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/Generator/Proxy/Schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,18 @@ public function __construct(string $type, ?string $config = null)
public function generate(SpecificationInterface $specification): Generator\Code\Chunks|string
{
$schema = new \PSX\Schema\Schema(TypeFactory::getAny(), $specification->getDefinitions());
$generator = $this->factory->getGenerator($this->type, $this->config);

return $this->factory->getGenerator($this->type, $this->config)->generate($schema);
$result = $generator->generate($schema);
if ($result instanceof Generator\Code\Chunks && $generator instanceof Generator\FileAwareInterface) {
$chunks = new Generator\Code\Chunks();
foreach ($result->getChunks() as $identifier => $content) {
$chunks->append($generator->getFileName($identifier), $generator->getFileContent($content));
}

return $chunks;
} else {
return $result;
}
}
}

0 comments on commit 401005e

Please sign in to comment.