fix: resolve labels field options using "label" key#6
Open
neptunix wants to merge 1 commit intotriptechtravel:mainfrom
Open
fix: resolve labels field options using "label" key#6neptunix wants to merge 1 commit intotriptechtravel:mainfrom
neptunix wants to merge 1 commit intotriptechtravel:mainfrom
Conversation
The ClickUp API returns label-type custom field options with a "label" key instead of "name" (which dropdown fields use). This caused all labels field operations to fail with "available: (none)" because the code only checked opt["name"]. Added getOptionName() helper that checks "name" first, falling back to "label". Updated all call sites: resolveLabelOptions, resolveDropdownOption, listOptionNames, formatDropdownValue, and formatLabelsValue. Fixes setting labels fields via --field "SF :: Team=Web" on both task create and task edit, including comma-separated multi-labels.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
"label"key in the ClickUp API response, while dropdown fields use"name". All option resolution code only checked"name", causing labels fields to fail withlabel "X" not found for field "Y" (available: (none)).getOptionName()helper that checks"name"first, falling back to"label", and updated all call sites.Fixes setting labels fields via
--field "SF :: Team=Web"ontask createandtask edit, including comma-separated multi-labels like--field "SF :: Team=Web,Phoenix".Root cause
The ClickUp API returns different key names for option display text depending on field type:
drop_down):{"name": "Feature", "id": "...", "orderindex": 0}labels):{"label": "Web", "id": "...", "orderindex": 3}The existing code in
resolveLabelOptions,resolveDropdownOption,listOptionNames,formatDropdownValue, andformatLabelsValueall only checkedopt["name"].Changes
custom_fields.go: AddedgetOptionName(opt)that returnsopt["name"]oropt["label"]getOptionName()instead of directopt["name"]accessTest plan
go test ./...)clickup task create --field "SF :: Team=Web"succeeds (was:label "Web" not found)clickup task edit <id> --field "SF :: Team=Web,Phoenix"sets both labelsclickup task view <id>displays labels field values correctly🤖 Generated with Claude Code