Process profiles in filter phase#2548
Conversation
1a22085 to
0a4c35b
Compare
Signed-off-by: Michael Edgar <michael@xlate.io>
0a4c35b to
6f22686
Compare
|
|
@Azquelt I don't recall if you were curious to look at this one. I'll be looking to do a release in the next day or two, so please let me know if you'd like some additional time to go over it. |
| public static boolean includedProfile(Extensible<?> extensible, Set<String> included, Set<String> excluded) { | ||
| Set<String> profiles = getProfiles(extensible); | ||
|
|
||
| if (!excluded.isEmpty()) { | ||
| return excluded.stream().noneMatch(profiles::contains); | ||
| } | ||
|
|
||
| if (included.isEmpty()) { | ||
| return true; | ||
| } | ||
|
|
||
| return included.stream().anyMatch(profiles::contains); | ||
| } | ||
|
|
There was a problem hiding this comment.
This looks a bit sketchy. Can the user specify both and include list and an exclude list?
It's odd that the include list is ignored completely if the exclude list is specified.
I realise this logic has not changed.
There was a problem hiding this comment.
Good point, I agree on that. Maybe something like this would be better (plus updating the test). Both include and exclude could be specified.
public static boolean includedProfile(Extensible<?> extensible, Set<String> included, Set<String> excluded) {
Set<String> profiles = getProfiles(extensible);
if (profiles.isEmpty()) {
// Include an extensible without any profiles attached when none
// are explicitly included via configuration.
return included.isEmpty();
}
if (included.stream().anyMatch(profiles::contains)) {
return true;
}
if (excluded.stream().anyMatch(profiles::contains)) {
// Exclude the extensible if it has configured exclusions and also
// does not have any configured inclusions. This also means that
// inclusion overrides exclusion if a profile is configured for both.
return false;
}
return included.isEmpty();
}


For quarkusio/quarkus#53479
This change moves the handling of operation profiles to the filter phase, allowing operations contributed to the model from a static file or
OASModelReaderto be included/excluded according to any given configurations.