@@ -394,10 +394,11 @@ protected void normalizePaths() {
394394 if (Boolean .TRUE .equals (getRule (FILTER ))) {
395395 String filters = inputRules .get (FILTER );
396396 Filter filter = createFilter (this .openAPI , filters );
397- filter .parse ();
398- // Iterates over each HTTP method in methodMap, retrieves the corresponding Operations from the PathItem,
399- // and marks it as internal (`x-internal=true`) if the method/operationId/tag/path is not in the filters.
400- filter .apply (pathsEntry .getKey (), path , methodMap );
397+ if (filter .parse ()) {
398+ // Iterates over each HTTP method in methodMap, retrieves the corresponding Operations from the PathItem,
399+ // and marks it as internal (`x-internal=true`) if the method/operationId/tag/path is not in the filters.
400+ filter .apply (pathsEntry .getKey (), path , methodMap );
401+ }
401402 }
402403
403404 // Include callback operation as well
@@ -1812,6 +1813,7 @@ protected static class Filter {
18121813 protected Set <String > methodFilters = Collections .emptySet ();
18131814 protected Set <String > tagFilters = Collections .emptySet ();
18141815 protected Set <String > pathStartingWithFilters = Collections .emptySet ();
1816+ private boolean hasFilter ;
18151817
18161818 protected Filter (String filters ) {
18171819 this .filters = filters .trim ();
@@ -1848,10 +1850,10 @@ private void doParse() {
18481850 String filterKey = filterStrs [0 ].trim ();
18491851 String filterValue = filterStrs [1 ];
18501852 Set <String > parsedFilters = splitByPipe (filterValue );
1853+ hasFilter = true ;
18511854 if (OPERATION_ID .equals (filterKey )) {
18521855 operationIdFilters = parsedFilters ;
18531856 } else if (METHOD .equals (filterKey )) {
1854-
18551857 methodFilters = parsedFilters ;
18561858 } else if (TAG .equals (filterKey )) {
18571859 tagFilters = parsedFilters ;
@@ -1909,7 +1911,7 @@ protected boolean hasCustomFilterMatch(String path, Operation operation) {
19091911 }
19101912
19111913 public boolean hasFilter () {
1912- return ! operationIdFilters . isEmpty () || ! methodFilters . isEmpty () || ! tagFilters . isEmpty () || ! pathStartingWithFilters . isEmpty () ;
1914+ return hasFilter ;
19131915 }
19141916
19151917 public void apply (String path , PathItem pathItem , Map <String , Function <PathItem , Operation >> methodMap ) {
0 commit comments