Page MenuHomePhabricator

Support schema references
Closed, ResolvedPublic5 Estimated Story Points

Description

Some of the known use cases such as the mentor list or the newcomers task have "complex" data types such as Mentor or TaskType. It would be nice to support references completely but building the corresponding form would be challenging and potentially lead to a bad UX.

We can restrict references to the first level of depth in the JSON schema to support the mentioned cases.

Data schema:

"properties": {
      "copyedit": {
              "type": { "$ref": "#/$defs/TaskType" },
               "default": {}
},
"$defs": {
		"TaskType": {
			"type": "object",
			"properties": {
				"disabled": {
					"type": "boolean",
					"default": false
				},
				"templates": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"excludedTemplates": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"excludedCategories": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"excludedSections": {
					"type": "array",
					"items": {
						"type": "string"
					}
				},
				"type": {
					"type": "string"
				},
				"group": {
					"type": "string"
				},
				"learnmore": {
					"type": "string"
				},
				"maxTasksPerDay": {
					"type": "number"
				},
				"maximumLinksToShowPerTask": {
					"type": "number"
				}
			},
			"required": [
				"disabled",
				"templates",
				"type",
				"group"
			],
			"additionalProperties": false
		}
	},

Note that default being {} is invalid, we should think of what are the common default values across task types.

The task is to modify the form builder to support such case. It should not require any new component.

Event Timeline

KStoller-WMF set the point value for this task to 5.Mar 5 2024, 5:33 PM

Change 1010184 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/extensions/CommunityConfiguration@master] [WIP] Editor: add support for schema references

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

Sgs raised the priority of this task from Medium to High.Mar 19 2024, 3:30 PM

I submitted a PoC patch 1010184. There's no support for external schema references, and I'm not sure if we should support at this point. Feedback welcome.

Urbanecm_WMF subscribed.

Needs changes per the CC technical meeting (see my commit on the PoC patch).

Change #1015288 had a related patch set uploaded (by Sergio Gimeno; author: Sergio Gimeno):

[mediawiki/core@master] ReflectionSchemaSource: add support for JSON schema $refs

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

Change #1017280 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] ReflectionSchemaSource: Add loadAsSchema()

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

Change #1017289 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/extensions/CommunityConfiguration@master] JsonSchemaBuilder: Use loadAsSchema()

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

Change #1015288 merged by jenkins-bot:

[mediawiki/core@master] ReflectionSchemaSource: add support for JSON schema $refs

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

Change #1017280 merged by jenkins-bot:

[mediawiki/core@master] ReflectionSchemaSource: Add loadAsSchema()

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

Change #1010184 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] Editor: add support for schema references

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

Change #1017289 merged by jenkins-bot:

[mediawiki/extensions/CommunityConfiguration@master] JsonSchemaBuilder: Use loadAsSchema()

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

Change #1017368 had a related patch set uploaded (by Urbanecm; author: Urbanecm):

[mediawiki/core@master] JsonSchemaReferenceResolver: Improve styling and docstring

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

Change #1017368 merged by jenkins-bot:

[mediawiki/core@master] JsonSchemaReferenceResolver: Improve styling and docstring

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