public boolean isTraitApplied(ToShapeId shapeId) {
        Shape shape = model.getShape(shapeId.toShapeId()).orElse(null);

        if (shape == null) {
            return false;
        }

        if (shape.getMemberTrait(model, traitClass).isPresent()) {
            return true;
        }

        if (!inheritFromContainer || !shape.asMemberShape().isPresent()) {
            return false;
        }

        // Check if the parent of the member is marked with the trait.
        MemberShape memberShape = shape.asMemberShape().get();
        Shape parent = model.getShape(memberShape.getContainer()).orElse(null);
        return parent != null && parent.hasTrait(traitClass);
    }
Checks if the trait is effectively applied to a shape.

@param shapeId Shape to test.
@return Returns true if the trait is effectively applied to the shape.
smithy-model/src/main/java/software/amazon/smithy/model/traits/EffectiveTraitQuery.java