Page MenuHomePhabricator

[Front-end/Function editor]: Adapt Type Selector to work with lightweight enum types
Closed, ResolvedPublic

Description

Description

Goals
  • Users should be able to create new functions that take persisted enum types as their input or output types
Technical details

Example User Flow

Step 1: Create a Function that takes "Enumeration of grammatical gender"

Prerequisite: The persisted lightweight enum type "Enumeration of grammatical gender" should be created as described in T391918: [Front-end/Default view]: Allow easy creation and edition of valid and wellformed lightweight enum types

  1. Go to the Function Editor to create a new function: https://www.wikifunctions.org/wiki/Special:CreateObject?zid=Z8
  2. Set a name for your function
  3. For the "Input 1", in the "Type" field, search for "enum"

Expected outcome:

  • "Typed enum of Wikidata references" should not appear in the lookup options
  • "Enumeration of grammatical gender" should appear in the lookup options
  • Choosing "Enumeration of grammatical gender/Z23772" will create a function with an input type set to Z23772
Screenshot from 2025-04-24 10-35-12.png (301×520 px, 17 KB)
Screenshot from 2025-04-24 10-36-51.png (309×516 px, 20 KB)
❌ not good✅ good

Step 2: Publish the Function

  1. Set a valid output (e.g. String)
  2. Click "Publish"

Expected outcome:

  • The function should be successfully persisted
  • The user should be redirected to the function page
  • The input type should be "Enumeration of grammatical gender"

Screenshot from 2025-04-24 11-21-16.png (586×637 px, 53 KB)

Completion checklist

Event Timeline

DSmit-WMF updated the task description. (Show Details)

Change #1144566 had a related patch set uploaded (by Daphne Smit; author: Daphne Smit):

[mediawiki/extensions/WikiLambda@master] TypeSelector.vue: Adapt Type Selector to work with lightweight enum types

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

Change #1144566 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] TypeSelector.vue: Adapt Type Selector to work with lightweight enum types

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