Link validation triggering for both shapes (validation not working properly)

so this is a bit complicated, giving some overview first,

We have shapes with different linkValidations (functions written separately)
Below code is for all the shapes,

this linkValidations is being used for all the shapes separately,

Link validation function for Activity
Where 1 and 10 represents the No. of connections

Same for other shapes as well, just the value of No. conectons is different.

But the problem is that when, i snap connection between 2 nodes, linkValidations for both the shapes gets triggered, although different shapes have different No. of connections

so this kind of error shows up. But i need to trigger only only link validation from the node im making the connection only that linkValidation should trigger, not linkValidation for both shapes

Outgoing link validation code,
Paramter MaxOutgoing is different for different shapes, but both the shapes linkValidations gets triggered due to which the linkValidation doesnt work properly.

Is there any better way to do this?

PS: If the question is not clear i can give you more reference.

I’m not sure if this is exactly what you want, but have you tried setting or binding the fromMaxLinks and toMaxLinks properties to the values that you desire?