@Override
    public List<ValidationEvent> validate(Model model) {
        Set<DocumentShape> documents = model.shapes(DocumentShape.class).collect(Collectors.toSet());
        if (documents.isEmpty()) {
            return Collections.emptyList();
        }

        Set<ShapeId> noInlineDocumentSupport = findProtocolsWithNoInlineDocumentSupport(model);
        if (noInlineDocumentSupport.isEmpty()) {
            return Collections.emptyList();
        }

        List<ServiceShape> services = model.shapes(ServiceShape.class).collect(Collectors.toList());
        Walker walker = new Walker(model);
        List<ValidationEvent> events = new ArrayList<>();

        for (ServiceShape service : services) {
            // Find all service shapes that use a protocol that does not
            // support documents.
            for (ShapeId protocol : noInlineDocumentSupport) {
                if (service.findTrait(protocol).isPresent()) {
                    // Find if the service uses a document.
                    Set<Shape> shapes = walker.walkShapes(service);
                    Set<Shape> foundDocuments = new TreeSet<>();
                    for (DocumentShape documentShape : documents) {
                        if (shapes.contains(documentShape)) {
                            foundDocuments.add(documentShape);
                        }
                    }
                    // Only emit if a document was found in the closure.
                    if (!foundDocuments.isEmpty()) {
                        events.add(createEvent(service, service.findTrait(protocol).get(), foundDocuments));
                    }
                }
            }
        }

        return events;
    }
Detects when a protocol indicates that it does not support inline documents,
yet the protocol trait is attached to a service that uses inline documents.
smithy-model/src/main/java/software/amazon/smithy/model/validation/validators/NoInlineDocumentSupportValidator.java