@Override
            public Set<String> objectNode(ObjectNode node) {
                Set<String> result = new HashSet<>();

                if (node.getMember("$ref").isPresent()) {
                    node.getMember("$ref")
                            .flatMap(Node::asStringNode)
                            .map(StringNode::getValue)
                            .ifPresent(result::add);
                } else {
                    for (Node member : node.getMembers().values()) {
                        result.addAll(member.accept(this));
                    }
                }

                return result;
            }
Removes unused components from the OpenAPI model.

<p>This plugin will take effect by default, but can be disabled by setting
"openapi.keepUnusedComponents" to true. Refs are removed in rounds until
a round of removals has no effect.

<p>TODO: This plugin currently only supports the removal of schemas and security schemes.
smithy-openapi/src/main/java/software/amazon/smithy/openapi/fromsmithy/mappers/RemoveUnusedComponents.java