Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to exchange reference datatype by list_item_id #63

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jacobtylerwalls
Copy link
Member

@jacobtylerwalls jacobtylerwalls commented Feb 12, 2025

Makes change discussed in planning earlier today. (Pull from the core arches branch!)

Adds ability to write back an array of list item ids for a reference datatype. I didn't bother to remove the code that permitted sending back the entire tile value.

Reads now give you an array of the following objects:

export interface ControlledListItem {
    list_item_id: string;
    display_value: string;
}

You can even post back that representation without changing it, and the display_value will be discarded.

Partner Lingo PR: archesproject/arches-lingo#213

Comment on lines 165 to 173
# Pre-process to discard display values generated by to_representation().
pre_processed_values = []
for single_value in value:
if isinstance(single_value, dict) and (
list_item_id := single_value.get("list_item_id")
):
pre_processed_values.append(list_item_id)
else:
pre_processed_values.append(single_value)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This probably belongs in the serialization layer instead of here, but I'm just getting a first iteration out to unblock folks.

@jacobtylerwalls jacobtylerwalls force-pushed the jtw/make-serializer-change branch from 8a854b0 to 305aec2 Compare February 13, 2025 21:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant