private Model filterMetadata(
            Model model,
            Config config,
            List<ValidationEvent> suppressedEvents,
            Set<String> removedValidators
    ) {
        // Next remove metadata suppressions that didn't suppress anything.
        ArrayNode suppressionsNode = model.getMetadata()
                .getOrDefault("suppressions", Node.arrayNode())
                .expectArrayNode();
        List<ObjectNode> updatedMetadataSuppressions = new ArrayList<>();

        for (Node suppressionNode : suppressionsNode) {
            ObjectNode object = suppressionNode.expectObjectNode();
            String id = object.getStringMemberOrDefault("id", "");
            String namespace = object.getStringMemberOrDefault("namespace", "");
            if (config.getRemoveReasons()) {
                object = object.withoutMember("reason");
            }

            // Only keep the suppression if it passes each filter.
            if (isAllowed(id, config.getEventIdAllowList(), config.getEventIdDenyList())
                    && isAllowed(namespace, config.getNamespaceAllowList(), config.getNamespaceDenyList())) {
                if (!config.getRemoveUnused()) {
                    updatedMetadataSuppressions.add(object);
                } else {
                    Suppression suppression = Suppression.fromMetadata(object);
                    for (ValidationEvent event : suppressedEvents) {
                        if (!removedValidators.contains(event.getId()) && suppression.test(event)) {
                            updatedMetadataSuppressions.add(object);
                            break;
                        }
                    }
                }
            }
        }

        ArrayNode updatedMetadataSuppressionsNode = Node.fromNodes(updatedMetadataSuppressions);
        if (suppressionsNode.equals(updatedMetadataSuppressionsNode)) {
            return model;
        }
        Model.Builder builder = model.toBuilder();
        builder.removeMetadataProperty("suppressions");
        if (!updatedMetadataSuppressions.isEmpty()) {
            builder.putMetadataProperty("suppressions", updatedMetadataSuppressionsNode);
        }
        return builder.build();
    }
Sets a list of namespaces that cannot be referred to in metadata suppressions.

<p>Metadata suppressions that refer to namespaces in this list,
including "*", will be removed.

<p>This setting cannot be used in tandem with {@code namespaceAllowList}.

@param namespaceDenyList Namespaces to deny.
smithy-build/src/main/java/software/amazon/smithy/build/transforms/FilterSuppressions.java