Skip to content

fix: encode empty merge_requests body as JSON object instead of array#554

Merged
jakubbortlik merged 1 commit intoharrisoncramer:developfrom
Cliffback:fix/empty-dict-merge-requests
Apr 29, 2026
Merged

fix: encode empty merge_requests body as JSON object instead of array#554
jakubbortlik merged 1 commit intoharrisoncramer:developfrom
Cliffback:fix/empty-dict-merge-requests

Conversation

@Cliffback
Copy link
Copy Markdown
Contributor

When choose_merge_request() is called without arguments, the body function returns an empty Lua table {} which vim.json.encode serializes as a JSON array []. The Go server expects a JSON object and fails with: 'cannot unmarshal array into Go value of type ListProjectMergeRequestsOptions'

Using vim.empty_dict() ensures the empty table is encoded as {} instead.

When choose_merge_request() is called without arguments, the body
function returns an empty Lua table {} which vim.json.encode serializes
as a JSON array []. The Go server expects a JSON object and fails with:
'cannot unmarshal array into Go value of type ListProjectMergeRequestsOptions'

Using vim.empty_dict() ensures the empty table is encoded as {} instead.
@jakubbortlik jakubbortlik merged commit f3b2c92 into harrisoncramer:develop Apr 29, 2026
4 checks passed
@jakubbortlik
Copy link
Copy Markdown
Collaborator

Thanks for reporting and fixing this!

@Cliffback
Copy link
Copy Markdown
Contributor Author

No problem, happy to help!

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.

2 participants