Page MenuHomePhabricator

Allow DefaultUserOptions (and ConditionalUserOptions) to contain descriptions
Open, Needs TriagePublic

Description

config values in extension.json can contain objects with descriptions and other metadata: https://www.mediawiki.org/wiki/Manual:Extension.json/Schema#Changes_in_manifest_version_2

DefaultUserOptions and ConditionalUserOptions can only contain values.

As a workaround in VE, we document with keys in the root of extension.json

"@DefaultUserOptions1": "'visualeditor-enable' is only read when in legacy beta feature mode ('VisualEditorEnableBetaFeature').",
"@DefaultUserOptions2": "'visualeditor-betatempdisable' is only read when NOT in beta feature mode.",
"@DefaultUserOptions3": "'visualeditor-autodisable' records whether the user has explicitly opted out of VE while it was in beta.",
"DefaultUserOptions": {
	"visualeditor-autodisable": 0,
	"visualeditor-betatempdisable": 0,
	"visualeditor-collab": 0,
	...
},

It would be better if they also supported metadata.

Event Timeline

Change #1192872 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] Extension schema: Improve validation of DefaultUserOptions and ConditionalUserOptions

https://gerrit.wikimedia.org/r/1192872

Change #1195745 had a related patch set uploaded (by Esanders; author: Esanders):

[mediawiki/core@master] Extension schema: Allow user options to have descriptions

https://gerrit.wikimedia.org/r/1195745

Is this really necessary when you also need to implement a GetPreferences hook handler to have preferences, which seems like a better place to document the options?

Change #1192872 merged by jenkins-bot:

[mediawiki/core@master] Extension schema: Improve validation of DefaultUserOptions and ConditionalUserOptions

https://gerrit.wikimedia.org/r/1192872

Is this really necessary when you also need to implement a GetPreferences hook handler to have preferences, which seems like a better place to document the options?

Not 100%, but I think it's a lot more convenient in many cases. extenson.json is a fixed place to go that users know they can find some config documentation already, whereas the GetPreferences hook could live anywhere. This is helpful for new developers, or someone inspecting multiple repos and looking at preferences used, e.g. a DBA. Storing the descriptions in structured data would also allow us to automatically publish option descriptions elsewhere, e.g. on mediawiki.org Extension: pages.