Description
Goals
- Users should be able to create new functions that take persisted enum types as their input or output types
Technical details
- Depends on T391918: [Front-end/Default view]: Allow easy creation and edition of valid and wellformed lightweight enum types
- Depends on T391915: [PHP/DB]: Audit and fix the way lightweight enum types are registered in the secondary tables to make them searchable
- Function Editor uses the component TypeSelector.vue for input and output type selection
- TypeSelector currently allows direct selection of:
- objects of type Z4
- generic types (functions that return a type Z4, such as typed list/Z881, typed pair/Z882 or typed map/Z883
- the generic type lightweight enum type/Z884 should not be selectable
- TypeSelector currently doesn't allow selection of:
- persisted generic types (e.g. a lightweight enum/Z6884 already persisted)
- persisted lightweight enum types should be searchable and selectable
- persisted generic types (e.g. a lightweight enum/Z6884 already persisted)
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
- Go to the Function Editor to create a new function: https://www.wikifunctions.org/wiki/Special:CreateObject?zid=Z8
- Set a name for your function
- 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
| ❌ not good | ✅ good |
Step 2: Publish the Function
- Set a valid output (e.g. String)
- 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"
Completion checklist
- Before closing this task, review one by one the checklist available here: https://www.mediawiki.org/wiki/Abstract_Wikipedia_team/Definition_of_Done#Front-end_Task/Bug_Completion_Checklist


