-
Notifications
You must be signed in to change notification settings - Fork 679
fix: make ResponseMessage.Result omitzero #1533
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
Conversation
According to the JSON-RPC specification, a response object must include either a `result` field or an `error` field, but not both. Without omitzero, if `Result` is nil, it is marshalled as 'null', causing both `result` and `error` fields to appear in the JSON object when `Error` is also present, which violates the specification.
What client are you using that is so strict? |
Neovim on the master branch. This is actually caused by my pull request that added the capability to distinguish between |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but since I pushed to it last, I can no longer approve and merge it 😅
Technically you could merge main and then I could merge the PR 😉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Wow, it feels like this shouldn’t work that way. |
Sorta kinda, I could have also sent code via GitHub code suggestions and you could have merged them in via the UI and it would still commit "as me" and do the same thing, so, oh well. |
According to the JSON-RPC specification, a response object must include either a
result
field or anerror
field, but not both.Without omitzero, if
Result
is nil, it is marshalled as 'null', causing bothresult
anderror
fields to appear in the JSON object whenError
is also present, which violates the specification.