Skip to content

Keep wildcard keys when a mapped value is null or empty - #653

Open
Cherith1222 wants to merge 1 commit into
python-restx:masterfrom
Cherith1222:issue-409-wildcard-null
Open

Cherith1222 wants to merge 1 commit into
python-restx:masterfrom
Cherith1222:issue-409-wildcard-null

Conversation

@Cherith1222

Copy link
Copy Markdown

Proposed changes

Wildcard marshalling treated a null value, or an empty list, as the end of the mapping. Keys that had not been visited yet were dropped. List.format(None) is [], so an empty list compared equal to the old end sentinel. The scan now ends only when no further key remains. A null value is still included unless skip_none is set, and an empty list is kept.

Fixes #409
Fixes #283

Cherith reviewed this diff and confirmed it with the person who helped draft it.
Drafted with Cursor. Model: Grok 4.7.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist

  • I have read the guidelines for contributing
  • All unit tests pass on my local version with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

Further comments

Windows, Python 3.13. pytest tests --benchmark-skip (the same skip inv test uses): 1233 passed, 6 skipped. tzdata was installed so zoneinfo can resolve CET on Windows. Benchmarks were not run. tox was not run; this machine does not have the other Python versions in the matrix.

A wildcard stopped scanning when a mapped value was null, or when a
list value was empty, so later keys were dropped. Remember whether
another key remains instead of treating those values as the end.

Fixes python-restx#409
Fixes python-restx#283

AI-assisted (Cursor)
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.

Wildcard dictionary omits keys with null values Wildcard with list values doesn't like empty lists

1 participant