Skip to content

Conversation

@JakovKnezovicc
Copy link
Contributor

@JakovKnezovicc JakovKnezovicc commented Jan 16, 2026

Adds mechanism for updating openapi spec by implementing custom processors that mutate openapi object in order of priority.
Included to container build if enabled as a feature in config passed via container parameter.

@JakovKnezovicc JakovKnezovicc self-assigned this Jan 16, 2026
new Reference('api_platform.openapi.factory.inner'),
new TaggedIteratorArgument(
tag: 'netgen_api_platform_extras.open_api_processor',
defaultPriorityMethod: 'getPriority',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be deprecated in Symfony 8.1, so better not to use it here. Instead, we should sort the processors list in the factory class.

Check here for more info symfony/symfony#62339

and here on how I solved in Layouts netgen-layouts/layouts-core@e17483b (it's for default_index_method, but the principle applies)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

removed in 02247a1

final readonly class OpenApiFactory implements OpenApiFactoryInterface
{
/**
* @param iterable<OpenApiProcessorInterface> $processors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FQCN missing.

use Symfony\Component\HttpKernel\Bundle\Bundle;

final class NetgenApiPlatformExtrasBundle extends Bundle {}
final class NetgenApiPlatformExtrasBundle extends Bundle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will need to be rebased as it will conflict once we merge #2 .

use ApiPlatform\OpenApi\OpenApi;
use Netgen\ApiPlatformExtras\OpenApi\Processor\OpenApiProcessorInterface;

final readonly class OpenApiFactory implements OpenApiFactoryInterface
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary readonly.

@JakovKnezovicc JakovKnezovicc force-pushed the NGSTACK-1017-schema-processor branch from 309c473 to 27de09f Compare January 19, 2026 10:40
@JakovKnezovicc JakovKnezovicc changed the base branch from master to NGSTACK-1017-iri-template-generation January 19, 2026 10:42
Base automatically changed from NGSTACK-1017-iri-template-generation to master January 19, 2026 12:40

$container->registerForAutoconfiguration(OpenApiProcessorInterface::class)
->addTag('netgen_api_platform_extras.open_api_processor')
->setLazy(true);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you need lazy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i prefer to use lazy but you are right to point out that it doesn't make sense here, all processors are iterated so we get no benefit of proxy service. Removed in 9c0e3c1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants