Skip to content

Commit

Permalink
OpenApiPlugin: fix for nette/di 3.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
f3l1x committed Feb 23, 2024
1 parent cb464d4 commit 16f8103
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/OpenApi/DI/OpenApiPlugin.php
Expand Up @@ -50,15 +50,15 @@ public function loadPluginConfiguration(): void

if ($config->definitions === []) {
$schemaBuilder
->addSetup('addDefinition', [new BaseDefinition()])
->addSetup('addDefinition', [new Statement(BaseDefinition::class)])
->addSetup('addDefinition', [$coreDefinition]);
foreach ($config->files as $file) {
if (str_ends_with($file, '.neon')) {
$schemaBuilder->addSetup('addDefinition', [new NeonDefinition($file)]);
$schemaBuilder->addSetup('addDefinition', [new Statement(NeonDefinition::class, [$file])]);
} elseif (str_ends_with($file, '.yaml') || str_ends_with($file, '.yml')) {
$schemaBuilder->addSetup('addDefinition', [new YamlDefinition($file)]);
$schemaBuilder->addSetup('addDefinition', [new Statement(YamlDefinition::class, [$file])]);
} elseif (str_ends_with($file, '.json')) {
$schemaBuilder->addSetup('addDefinition', [new JsonDefinition($file)]);
$schemaBuilder->addSetup('addDefinition', [new Statement(JsonDefinition::class, [$file])]);
} else {
throw new InvalidArgumentException(sprintf(
'We cant parse file "%s" - unsupported file type',
Expand All @@ -67,7 +67,7 @@ public function loadPluginConfiguration(): void
}
}

$schemaBuilder->addSetup('addDefinition', [new ArrayDefinition($config->definition)]);
$schemaBuilder->addSetup('addDefinition', [new Statement(ArrayDefinition::class, [$config->definition])]);
} else {
foreach ($config->definitions as $definitionName => $definitionConfig) {
$definitionDef = $builder->addDefinition($this->prefix('definition.' . $definitionName))
Expand Down

0 comments on commit 16f8103

Please sign in to comment.