openai / openai/openai-python

Querystring drops explicit empty-string scalar values

Open Beginner friendly
#3,837 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

v4
Dominant language
Python
Stars
31.6k
Forks
5.7k
Avg merge
1d 6h
Merged PRs (30d)
96

Description

Querystring.stringify() drops an explicit empty-string scalar because _stringify_item() checks the serialized value with a truthiness test.

stringify({"filter": ""}) == ""  # current behavior

This conflates an explicit empty value with None. In a URL query, filter= is distinct from omitting filter entirely. The behavior is also inconsistent across array formats, where an empty string can be retained by comma serialization.

Expected behavior: continue omitting None, but serialize an explicit empty string as filter=.

Contributor guide

Open the contributing guide

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 at Querystring.stringify() and _stringify_item(), using the reproduction in the issue to trace how scalar values are serialized. Verify that None remains omitted while an explicit empty string produces filter=, including the array formats mentioned in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
86/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.