Potential bug with JsonCanvas canvas toEnd/fromEnd handling

Hi,

given the specification of JSONCanvas it is unclear how a missing toEnd value should be rendered in a client. The way Obsidian handles it creates some inconsistencies between the handling of missing values between toEnd and fromEnd.

Steps to reproduce

Import this:

{
	"nodes":[
		{"id":"2b379688cb8e80af","type":"text","text":"1","x":-180,"y":-220,"width":250,"height":60},
		{"id":"b5a72b2c798a04ae","type":"text","text":"2","x":-180,"y":-140,"width":250,"height":60},
		{"id":"49bee2dc1b57b15c","type":"text","text":"3","x":-180,"y":-60,"width":250,"height":60},
		{"id":"f7f488e2507f1961","type":"text","text":"A","x":120,"y":-220,"width":250,"height":60},
		{"id":"54db5c0a49f8c751","type":"text","text":"B","x":120,"y":-140,"width":250,"height":60},
		{"id":"e4d03830baf9399b","type":"text","text":"C","x":120,"y":-60,"width":250,"height":60}
	],
	"edges":[
		{"id":"bed5afe75a3a3659","fromNode":"2b379688cb8e80af","fromSide":"right","toNode":"f7f488e2507f1961","toSide":"left"},
		{"id":"9aa154e4dce0ce46","fromNode":"b5a72b2c798a04ae","fromSide":"right","toNode":"54db5c0a49f8c751","toSide":"left","toEnd":"none"},
		{"id":"a8fa2e43e478d13f","fromNode":"49bee2dc1b57b15c","fromSide":"right","toNode":"e4d03830baf9399b","toSide":"left","fromEnd":"arrow"}
	]
}

This renders:

Expected result

I would suggest/expect that the JSONCanvas structure for the above screenshot would be like this instead, with explicit explicit declaration of the arrows and that absent definitions always means no arrow.

{
	"nodes":[
		{"id":"2b379688cb8e80af","type":"text","text":"1","x":-180,"y":-220,"width":250,"height":60},
		{"id":"b5a72b2c798a04ae","type":"text","text":"2","x":-180,"y":-140,"width":250,"height":60},
		{"id":"49bee2dc1b57b15c","type":"text","text":"3","x":-180,"y":-60,"width":250,"height":60},
		{"id":"f7f488e2507f1961","type":"text","text":"A","x":120,"y":-220,"width":250,"height":60},
		{"id":"54db5c0a49f8c751","type":"text","text":"B","x":120,"y":-140,"width":250,"height":60},
		{"id":"e4d03830baf9399b","type":"text","text":"C","x":120,"y":-60,"width":250,"height":60}
	],
	"edges":[
		{"id":"bed5afe75a3a3659","fromNode":"2b379688cb8e80af","fromSide":"right","toNode":"f7f488e2507f1961","toSide":"left","toEnd":"arrow"},
		{"id":"9aa154e4dce0ce46","fromNode":"b5a72b2c798a04ae","fromSide":"right","toNode":"54db5c0a49f8c751","toSide":"left"},
		{"id":"a8fa2e43e478d13f","fromNode":"49bee2dc1b57b15c","fromSide":"right","toNode":"e4d03830baf9399b","toSide":"left","toEnd":"arrow","fromEnd":"arrow"}
	]
}

Additional information

Thanks for post. It’s not necessarily a bug and I am gonna move to the developers and api section

Thanks,

I submitted an issue on the github repo for JSONCanvas also as the default behaviour is not specified with setting those values to null.