Introduce Generator settings#1748
Closed
DerManoMann wants to merge 2 commits into
Closed
Conversation
Contributor
|
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. |
Contributor
|
If you agree and don't have extra time, I can pr. |
Collaborator
Author
|
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 Could you please define what the actual criteria is to exclude attributes (without any new interface/logic, etc.)? |
Collaborator
Author
|
Having second thoughts about the way the settings are done, but other than that I think this is good. |
Contributor
|
This pr meets my needs perfectly. |
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.
a07600b to
f970452
Compare
Collaborator
Author
|
Closing in favour of #1756 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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]]);