Conversation
| new Reference('api_platform.openapi.factory.inner'), | ||
| new TaggedIteratorArgument( | ||
| tag: 'netgen_api_platform_extras.open_api_processor', | ||
| defaultPriorityMethod: 'getPriority', |
There was a problem hiding this comment.
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)
| final readonly class OpenApiFactory implements OpenApiFactoryInterface | ||
| { | ||
| /** | ||
| * @param iterable<OpenApiProcessorInterface> $processors |
| use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
|
||
| final class NetgenApiPlatformExtrasBundle extends Bundle {} | ||
| final class NetgenApiPlatformExtrasBundle extends Bundle |
There was a problem hiding this comment.
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 |
… api processor tag
…on and sort processors in factory
309c473 to
27de09f
Compare
|
|
||
| $container->registerForAutoconfiguration(OpenApiProcessorInterface::class) | ||
| ->addTag('netgen_api_platform_extras.open_api_processor') | ||
| ->setLazy(true); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
There really is no point in using lazy, since most of the stuff gets initialized anyhow on initial request, since it is needed to actually generate the output.
lazy is used in highly specialized services which are heavy and used only in one or two places. There really is no sense in using lazy for a service that is used everywhere :)
|
Thanks @JakovKnezovicc ! |
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.