Why can I draw duplicate links?

I want to have ports that can be connected by a link, similiar to what is given: Draggable Link
The porst appear only when a mouse enters the node.
However, I don’t want duplicates: Links between the same two ports… However, for some reason my configuration allows this… I’m not sure why.
This is my port configuration:

     $(go.Shape, shapes.node, {

            fill: null,
            stroke: null,
            desiredSize: size,
            alignment: position,
            alignmentFocus: position,
            portId: portType,
            fromSpot: position,
            toSpot: position,
            fromLinkable: portType === portTypes.output,
            toLinkable: portType === portTypes.input,
            cursor: 'pointer'
        })

Set toLinkableDuplicates to false.

For more discussion, read GoJS Validation -- Northwoods Software

@simon setting those options doesn’t help, also, they should be false by default.
@walter I took a look at the discussion you provided, but I wasn’t able to recognize the issue.

This is my node template:

        $(go.Node, 'Spot',
               $(go.Shape, shapes.node, nodeShapeSettings(fillColor)),
               $(go.TextBlock, {editable: false, margin: 8, visible: false},
                        new go.Binding('text', 'value')),
               getPort(portTypes.input),
              getPort(portTypes.output),
              supportedEvents());

From the getPort function I return:

       $(go.Shape, shapes.node, {

        fill: null,
        stroke: null,
        desiredSize: size,
        alignment: position,
        alignmentFocus: position,
        portId: portType,
        fromSpot: position,
        toSpot: position,
        fromLinkable: portType === portTypes.output,
        toLinkable: portType === portTypes.input,
        cursor: 'pointer'
    })

The supportedEvents function just returns an object that contains moseenter and mouseleave events.

I’ve tried adding my own node template to the logic circuit example, and it works… hence, the error in my code must be somewhere else…

EDIT:

I think I found the problem while playing with the logical circuit example:

  myDiagram.model = go.Model.fromJson(document.getElementById("mySavedModel").value);
  myDiagram.model = new go.GraphLinksModel([], []);

The upper line loads the data from json which defines linkFromPortIdProperty and linkToPortIdProperty, while the one below doesn’t. The upper one works as in the example, the bottom one causes parallel links to appear.

My question is, should this be the default behaviour?

The default behavior for GraphLinksModel is to not to require each link data object to specify the exact ports with which it should connect. If you want to have multiple ports in your app and if you want that information saved in your model, you’ll need to set at least those two properties in your GraphLinksModel.

Or am I missing what you are trying to say?

Sorry for the late response.
I want to have two ports on my node and to have at most 1 link between two ports. I want to restrict the user from drawing parallel links.
I thought that setting the link properties fromPortId and toPortId would solve my issue… but it doesn’t…

EDIT: I solved it, I was giving the wrong IDs to the before mentioned properties. Thanks for your time and help :-)