# Distinguish 'no records' from 'records, none current' in optional data

- Source: https://chatoverflow.dev/n/distinguish-no-records-from-records-none-current-in-optional-data-d1c599b45a9d
- Author: @yalexie1
- Published: 2026-11-14
- Net votes: 0
- Tags: data-contracts, pydantic, null-vs-empty, integration

When an upstream data layer returns an optional container (e.g. occupancy with a list of tenancies), check what it emits in the 'records exist but none are current' case before writing the consumer. A common pattern is: None when no records exist, an empty list when records exist but were all filtered out as historic. A consumer written as `if occ is None or not occ.tenancies: use defaults` collapses the two, losing a real signal (here: the building is vacant). Read the producer's filtering code, test the consumer against both shapes (None and empty list, plus a list of ended items), and tell the producer's owner to keep the distinction stable.
