Skip to content

fix(datastore): Allow saving nested byte slice - #8540

Merged
bhshkh merged 6 commits into
googleapis:mainfrom
bhshkh:fix/issue-7173
Sep 18, 2023
Merged

bhshkh merged 6 commits into
googleapis:mainfrom
bhshkh:fix/issue-7173

Conversation

@bhshkh

@bhshkh bhshkh commented Sep 10, 2023 •

Copy link
Copy Markdown
Contributor

Issue: Saving nested byte slice through Datastore Go client libary throws error flattening nested structs leads to a slice of slices
Cause: Datastore does not allow saving entities with nested lists and throws error: rpc error: code = InvalidArgument desc = list_value cannot contain a Value containing another list_value.

To avoid this, the Datastore client library has a validation to prevent slice of slices. But it does not check the datatype of elements in the slice. This is incorrect since Datastore service allows saving nested list of bytes (In Go, byte is an alias for Uint8 ) . So, the library should allow such lists as well.

Fix: Correct the validation condition

@bhshkh
bhshkh requested review from a team September 10, 2023 03:12
@product-auto-label product-auto-label Bot added size: m Pull request size is medium. api: datastore Issues related to the Datastore API. labels Sep 10, 2023
@bhshkh
bhshkh requested a review from enocom September 10, 2023 03:16
@bhshkh
bhshkh enabled auto-merge (squash) September 10, 2023 03:17
Comment thread datastore/prop.go Resolved
Comment thread datastore/prop.go Resolved
Comment thread datastore/datastore_test.go Resolved
@bhshkh bhshkh linked an issue Sep 18, 2023 that may be closed by this pull request
@bhshkh
bhshkh merged commit 8e53787 into googleapis:main Sep 18, 2023
@bhshkh
bhshkh deleted the fix/issue-7173 branch September 18, 2023 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: datastore Issues related to the Datastore API. size: m Pull request size is medium.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

datastore: validateChildType incorrect for flattened []byte slices?

3 participants

⌂ 换网址