shouldDefinitionBeIncluded example


    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),
            };

            $schema = $this->definitionSchemaBuilder->getSchemaByDefinition(
                $definition,
                $this->getResourceUri($definition),
                
$this->openApiBuilder->enrich($openApi$api);

        $forSalesChannel = $api === DefinitionService::STORE_API;

        ksort($definitions);

        foreach ($definitions as $definition) {
            if (!$definition instanceof EntityDefinition) {
                continue;
            }

            if (!$this->shouldDefinitionBeIncluded($definition)) {
                continue;
            }

            $onlyReference = $this->shouldIncludeReferenceOnly($definition$forSalesChannel);

            $schema = $this->definitionSchemaBuilder->getSchemaByDefinition($definition$this->getResourceUri($definition)$forSalesChannel$onlyReference);

            $openApi->components->merge($schema);
        }

        $this->addGeneralInformation($openApi);
        
Home | Imprint | This part of the site doesn't use cookies.