Go js validation port shape vs main shape

In gojs shape we can specify how many links we there can be from that shape (e.g. fromaxLinks: 2)

that is ok,
but in my case I have some a main shape , and 4 corner ports.

I want to start linking from the ports (and not from the main shape)
my validation is that from the shape will go only one link.

how can this be done?

the same thing is for the shape receiving a link, I need it to get only one link.

If I understand your requirements correctly, you can just set GraphObject.fromMaxLinks and toMaxLinks on each of your port elements.

this will be ok for each port,
but I still need the ports and the validation rules should effect the whole (main) shape

Have you read GoJS Validation -- Northwoods Software ? You may need to specify a linkValidation predicate.

Thank this did the trick