Obsidian changing empty array to null in Frontmatter

Related to YAML: Empty multi-line array gets formatted into ambiguous format after properties edit but this bug report is closed and my use case is different.

I’m writing plugins that use the fact it’s an empty array to assert that it is a list and ensure type safety (via zod). If I edit the properties within the plugin and the associated views its fine, but when editing in obsidian this leads to failing schema validation.

My confusion is mostly that an empty array and null are not the same thing!

Steps to reproduce

Set a list property to empty

areas: []
otherfield: 'sometext'

Edit the other field

Expected result

areas: []
otherfield: 'someothertext'

Actual result

areas:
otherfield: 'someothertext'

Environment

SYSTEM INFO:
	Obsidian version: v1.4.16
	Installer version: v1.4.16
	Operating system: Darwin Kernel Version 23.1.0: Mon Oct  9 21:28:12 PDT 2023; root:xnu-10002.41.9~6/RELEASE_ARM64_T8103 23.1.0
	Login status: logged in
	Catalyst license: none
	Insider build toggle: off
	Live preview: on
	Legacy editor: off
	Base theme: dark
	Community theme: none
	Snippets enabled: 0
	Restricted mode: off
	Plugins installed: 5
	Plugins enabled: 5
		1: Hot Reload v0.1.10
		2: Atomic v0.0.0
		3: Melodical v0.0.0
		4: Organizer v0.0.0
		5: Tracker v0.0.0

RECOMMENDATIONS:
	Community plugins: for bugs, please first try updating all your plugins to latest. If still not fixed, please try to make the issue happen in the Sandbox Vault or disable community plugins.


As pointed out in the linked thread, this is intentional right now (so it’s not a bug). If you don’t like it, open a FR request. Thanks!

Whoops I put this in the wrong category. I’ve opened a feature request here. Please close!