Description
Goals
- Users should be able to use persisted enum types in their usual workflows:
- When trying a function that has a lightweight enum type as one of their input types, a user should be able to select a value from the enum list
- When selecting a type in Default View, users should be able to select any of the persisted enum types
Technical details
- Depends on T391915: [PHP/DB]: Audit and fix the way lightweight enum types are registered in the secondary tables to make them searchable
- Depends on T391916: [Front-end/Function editor]: Adapt Type Selector to work with lightweight enum types
Or add a different component, if needed.
Example User Flow
Flow 1: Use enum types in the Function Evaluator widget
Prerequisite:
- Create an enum type (e.g. "Enummeration of grammatical geners")
- Create a function that uses that enum type as an input (e.g. "Add article to lexeme")
- The function must have connected implementations
Step 1: Go to Function page
- Go to the view page for the "Add article to lexeme" function
- Explore the "Try this function" widget
Expected outcome:
- The field for "Enumeration of grammatical gender" should be identical to any other Enum (e.g. Month, boolean)
- Should render a codex selector component
- On click, should display the available options in the enum list
- The experience should be identical than with other enum types (e.g. "input month" field in "Get day of week from date" function: https://www.wikifunctions.org/wiki/Z13163 )
| Enum type selector | Enum type click on selector |
Step 2: Select input and try the Function
- Select "feminine" in the "grammatical gender" selector
- Click "Run function"
Expected outcome:
- On "network" exploration, the function call should have a valid shape with correct enum value selection:
{
"Z1K1": "Z7",
"Z7K1": "Z23773",
"Z23773K1": {
"Z1K1": "Z6095",
"Z6095K1": "L31222"
},
"Z23773K2": {
"Z1K1": "Z23772",
"Z23772K1": {
"Z1K1": "Z6091",
"Z6091K1": "Q1775415"
}
}
}Flow 2: Use enum types in Default View type selection
Case 1: Create a type with a key of type "Enumeration of grammatical genders"
- Go to Special:CreateObject
- Select Type
- Add a key, for 'value type' fill in 'Enumeration of grammatical genders' -> currently not working because of wikilambdasearch_type =Z4 does not yet return the wikidata enums. (no return type) @gengh will think about this
- Add a list item and this should show the selectbox with the enums (masculine, feminine, neuter)
Question: what should happen here. Its only searching for actual types so type=Z4, so it wont return the 'enumeration for gram gender'.
We can select function call and then it will show up. What should happen?
Expected outcome:
- 'Enumeration of grammatical genders' should appear in the list for 'value type'
| Read mode | Edit mode |
Case 2: Select instances in a typed list
- Go to Special:CreateObject
- Select 'function call' from the ModeSelector
- For 'function' fill in 'Typed List'
- For 'List item type' fill in 'Enumeration of grammatical genders' -> currently not working because of wikilambdasearch_type =Z4 does not yet return the wikidata enums. (no return type) @gengh will think about this
- Add a list item and this should show the selectbox with the enums (masculine, feminine, neuter)
- select on of them and publish
Expected outcome:
- 'Enumeration of grammatical genders' should appear in the list for 'list item type'
- Read only mode shows the wikidata enum name + link with the wikidata logo in front
- Edit mode shows a selectbox with the enums from the 'Enumeration of grammatical genders' list
- Publishes successfully with data structure: TBD
| Read mode | Edit mode |
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








