Introduce `Generator` settings
Generator settings are following the same pattern as processor config and are stored under the key 'generator'.
Generator::getSetting() provides a shortcut to access generator settings.
Fixes #1747 by allowing to set Generator::setConfig(['generator' => ['ignoreOtherAttributes' => true]]);
This is what I need, I think it can be designed to be more flexible.
Like:
$attributeArgs = ['IgnoreAnnotationClass1','IgnoreAnnotationClass2'];
foreach ($reflector->getAttributes() as $attribute) {
if (in_array($attribute::class, $attributeArgs, true)) {
continue;
}
}
or
interface IgnoreAttributes{}
foreach ($reflector->getAttributes() as $attribute) {
if ($attribute instanceof IgnoreAttributes) {
continue;
}
}
or to be more precise
interface IgnoreAttributes{
public function ignoreOAAttributes():bool;
}
foreach ($reflector->getAttributes() as $attribute) {
if ($attribute instanceof IgnoreAttributes && $attribute->ignoreOAAttributes()) {
continue;
}
}
I prefer the second or third one.
If you agree and don't have extra time, I can pr.
I think I am still not quite sure what the actual requirements are.
Excluding any attributes that are not OpenApi attributes should be all yours - unless you extend from AbstractAnnotation. But then I would expect that the library should process them...??
Could you please define what the actual criteria is to exclude attributes (without any new interface/logic, etc.)?
Having second thoughts about the way the settings are done, but other than that I think this is good.
This pr meets my needs perfectly.
Closing in favour of #1756