/**
* @param array<string, EntityDefinition>|array<string, EntityDefinition&SalesChannelDefinitionInterface> $definitions
*
* @return OpenApiSpec
*/
public function generate(array
$definitions, string
$api, string
$apiType = DefinitionService::TYPE_JSON_API, ?string
$bundleName = null
): array
{ $forSalesChannel =
$this->
containsSalesChannelDefinition($definitions);
$openApi =
new OpenApi([]);
$this->openApiBuilder->
enrich($openApi,
$api);
ksort($definitions);
foreach ($definitions as $definition) { if (!
$this->
shouldDefinitionBeIncluded($definition)) { continue;
} $onlyFlat =
match ($apiType) { DefinitionService::TYPE_JSON => true,
default =>
$this->
shouldIncludeReferenceOnly($definition,
$forSalesChannel),
};