fix(tasks): clear due date when --due= is set to empty#507
Closed
dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
Closed
fix(tasks): clear due date when --due= is set to empty#507dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
dinakars777 wants to merge 1 commit intoopenclaw:mainfrom
Conversation
When `gog tasks update --due=` was used with an empty value, the due date was not actually cleared. The help text says "set empty to clear" but the Google Tasks API PATCH treats an empty string the same as an omitted field due to `omitempty` JSON tagging. Add the "Due" field to `NullFields` when the due value is empty, which forces the API to send an explicit `null` in the PATCH request body, properly clearing the due date. Closes openclaw#437
Collaborator
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
When
gog tasks update --due=was used with an empty value, the due date was not actually cleared despite the help text stating "set empty to clear". The Google Tasks API PATCH treats an empty string the same as an omitted field due toomitemptyJSON tagging, so the due date remained unchanged.This fix adds
"Due"toNullFieldswhen the due value is empty, which forces the API to send an explicitnullin the PATCH request body, properly clearing the due date.Steps to Reproduce (before fix)
gog tasks update <listId> <taskId> --due= --forceExpected Behavior
The due date should be cleared (set to null).
Changes
--due=is provided with an empty value, add"Due"topatch.NullFieldsinstead of settingpatch.Due = ""warnTasksDueTimecall inside the non-empty branch since it's only relevant when a due date is being setTest plan
go build ./...compiles cleanlygo test ./internal/cmd/... -run TestTasksValidationpassesgog tasks update <listId> <taskId> --due= --forceclears the due dategog tasks update <listId> <taskId> --due=2026-05-01still sets the due date normallyCloses #437