private List<ValidationEvent> validateMqtt(OperationIndex index, TopicCollection topics) {
        Set<String> labels = topics.getLabels();
        StructureShape input = index.expectInputShape(topics.operation);
        List<ValidationEvent> events = new ArrayList<>();

        for (MemberShape member : input.getAllMembers().values()) {
            if (member.hasTrait(TopicLabelTrait.ID)) {
                if (labels.contains(member.getMemberName())) {
                    labels.remove(member.getMemberName());
                } else {
                    events.add(error(member,
                            member.expectTrait(TopicLabelTrait.class),
                            String.format(
                                    "This member is marked with the `smithy.mqtt#topicLabel` trait, but when this member is "
                                            + "used as part of the input of the `%s` operation, a corresponding label cannot be "
                                            + "found in the `%s` trait",
                                    topics.operation.getId(),
                                    Trait.getIdiomaticTraitName(topics.trait.toShapeId()))));
                }
            }
        }

        if (!labels.isEmpty()) {
            events.add(error(topics.operation,
                    topics.trait,
                    String.format(
                            "The `%s` trait contains the following topic labels that could not be found in the input "
                                    + "structure of the operation or were not marked with the `smithy.mqtt#topicLabel` trait: [%s]",
                            Trait.getIdiomaticTraitName(topics.trait.toShapeId()),
                            ValidationUtils.tickedList(labels))));
        }

        return events;
    }
Validates that labels are correct for MQTT topics on
{@code subscribe} and {@code publish} operations.

<ul>
    <li>Operation input is required when a topic has labels.</li>
    <li>Topic labels must be found in the input.</li>
    <li>The input must not contain extraneous labels.</li>
</ul>
smithy-mqtt-traits/src/main/java/software/amazon/smithy/mqtt/traits/validators/MqttTopicLabelValidator.java