Skip to content

Commit 5bc28d4

Browse files
committed
fix: preserve plugins with empty config when saving routes
Plugins that don't require configuration (e.g. key-auth) were being silently dropped when saving routes because fast-clean library removes empty objects by default. Setting emptyObjectsCleaner to false preserves these plugin entries.
1 parent a2ee27a commit 5bc28d4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/utils/producer.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* See the License for the specific language governing permissions and
1515
* limitations under the License.
1616
*/
17-
import { clean,type ICleanerOptions } from 'fast-clean';
17+
import { clean, type ICleanerOptions } from 'fast-clean';
1818
import { produce } from 'immer';
1919
import { pipe } from 'rambdax';
2020

@@ -27,6 +27,7 @@ export const deepCleanEmptyKeys = <T extends object>(
2727
clean(obj, {
2828
nullCleaner: true,
2929
cleanInPlace: true,
30+
emptyObjectsCleaner: false, // Keep empty objects for plugins that need no config (e.g. key-auth)
3031
...opts,
3132
});
3233

0 commit comments

Comments
 (0)