oxidecomputer / oxidecomputer/third-party-api-clients

sheets: Client implementation assumes `Vec<Vec<String>>` but numbers are possible

Open
#112 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
150
Forks
62
PR merge metrics
No merged PRs in 30d

Description

The sheets crate deserializes Spreadsheet value range responses as Vec<Vec<String>>, however when using ValueRenderOption::Formula or ValueRenderOption::UnformattedValue the Google sheets API will return numbers as JSON number values.

The problem is here:

https://github.com/oxidecomputer/third-party-api-clients/blob/0861ac206f597ddc709508ef711692576b761389/google/sheets/src/lib.rs#L723

Ultimately being called from here:

https://github.com/oxidecomputer/third-party-api-clients/blob/0861ac206f597ddc709508ef711692576b761389/google/sheets/src/spreadsheets.rs#L222

Where the type Out is ValueRange which has type: Vec<Vec<String>>, but the actual JSON has number values in it. Perhaps it's a bug in the API specification?

My ugly hack is to turn them into strings, and this diff can also help visualize the problem:

https://github.com/oxidecomputer/third-party-api-clients/compare/0861ac206f597ddc709508ef711692576b761389...webern:oxide-third-party-api-clients:patch-v1?expand=1

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in google/sheets/src/lib.rs around line 723, then follow the ValueRange use in google/sheets/src/spreadsheets.rs around line 222. Inspect how spreadsheet value range responses are deserialized for ValueRenderOption::Formula and ValueRenderOption::UnformattedValue. Done means responses containing JSON numbers deserialize successfully instead of assuming every value is a string.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.