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

backend: fix unmarshaling empty refids #1189

Merged
merged 1 commit into from
Jan 14, 2025
Merged

backend: fix unmarshaling empty refids #1189

merged 1 commit into from
Jan 14, 2025

Conversation

gabor
Copy link
Contributor

@gabor gabor commented Jan 8, 2025

fixes #1177

sometimes a response in a backend.QueryDataResponse has no refId (the refId is "").
this is technically not allowed, but we need to be able to handle the situation, otherwise we just error out with a cryptic error message.

@gabor gabor marked this pull request as ready for review January 8, 2025 13:08
@gabor gabor requested a review from a team as a code owner January 8, 2025 13:08
@gabor gabor requested review from wbrowne, andresmgot and oshirohugo and removed request for a team January 8, 2025 13:08
@gabor gabor force-pushed the gabor/fix-empty-refid branch from 4e6a25d to af88ffa Compare January 8, 2025 13:14
Copy link

@asimpson asimpson left a comment

Choose a reason for hiding this comment

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

LGTM 👍

l2Field := iter.ReadObject()
for {
// the response may have an empty-string refId. this is not allowed,
// but it may happen, and we want to be able to handle the case.
Copy link
Member

Choose a reason for hiding this comment

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

but it may happen, and we want to be able to handle the case.

Out of curiosity, how can this currently happen? Do we need validation elsewhere?

Copy link
Contributor

Choose a reason for hiding this comment

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

+1, we are removing the error here, therefore making having an empty refId valid. Is that what we want? From the issue description it appears that the goal is to return a meaningful error message, not remove the error.

Copy link
Contributor

Choose a reason for hiding this comment

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

Clarified offline that we want to actually avoid the error here.

@gabor gabor merged commit 2c603f5 into main Jan 14, 2025
3 checks passed
@gabor gabor deleted the gabor/fix-empty-refid branch January 14, 2025 08:10
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.

JSON Unmarshal fails if refID is an empty string.
4 participants