How do I add a validation constraint to a custom Symfony compound field type

I have created a custom form field type in Symfony 4 that has two sub-fields.
I want to create a custom validation constraint and apply it to the compound field, not one of the sub-fields (both are involved in the validation).

To complicate things a bit more, this custom field type and validation constraint are provided by a custom bundle, not by the application.

I know how to create the constraint and validation classes. What I don't know how to do is apply the constraint to the compound field.