-
Notifications
You must be signed in to change notification settings - Fork 937
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress the generation of operationId in the contract #1567
Comments
This can currently be solved by overriding the operationId in the OpenApi\Processors\OperationId.php:
Not a clean solution, but for now it works... |
Depends on how you are using swagger-php. Programmatically you always have the option to remove a processor from the pipeline. $generator = new Generator();
// ....
$generator->removeProcessor($processor); Only downside right now is that processors are compared using $processors = $generator->getProcessors();
$operationIdProcessor = null;
foreach ($processors as $processor) {
if ($processor instanceof OperationId) {
$operationIdProcessor = $processor;
break;
}
}
$generator->removeProcessor($operationIdProcessor); |
I just tried that, the OperationId-Processor is actually removed from the processors.
|
The If you insist on using Generator::scan($sources, ['processors' => $generator->getProcessors());
public static function scan(iterable $sources, array $options = []): ?OA\OpenApi
{
// merge with defaults
$config = $options + [
'aliases' => self::DEFAULT_ALIASES,
'namespaces' => self::DEFAULT_NAMESPACES,
'analyser' => null,
'analysis' => null,
'processors' => null,
'logger' => null,
'validate' => true,
'version' => null,
];
return (new Generator($config['logger']))
->setVersion($config['version'])
->setAliases($config['aliases'])
->setNamespaces($config['namespaces'])
->setAnalyser($config['analyser'])
->setProcessors($config['processors'])
->generate($sources, $config['analysis'], $config['validate']);
} |
Is it possible to suppress the generation of the operationId?
Currently the operationId is generated with a hash value if the attribute operationId is missing for an operation.
This causes strange behaviour with the OpenAPI-Generator for language java.
Besides that this needs to be fixed at the OpenAPI-Generator, is it possible to omit the operationId easily?
There is an issue with this topic, but it has no clear instructions how to omit the operationId:
#930
Some improvements to operationId were added here:
#942
Trying to instantiate the Generator manually is not allowed:
So how can the operationId be omitted generally?
The text was updated successfully, but these errors were encountered: