JSON output drops the version specifier of requirements.txt packages
Version: osv-scanner v2.7.0
Repro: a requirements.txt containing django~=4.2, scanned with --format json.
Actual: the package is reported as {"name": "django", "version": "4.2"}, the same as django==4.2.
Expected: the requirement's operator or full specifier (e.g. ~=4.2) in the JSON output, so consumers can tell an exact pin from the lower bound of a range. Matching advisories against a lower bound reports versions that may not be installed.
The extractor already records this internally (VersionComparator, Requirement), but it isn't serialized.
I’d like to work on this issue if it is available.
I’d trace how the extractor’s VersionComparator and Requirement metadata reaches the JSON reporter, then preserve the original requirement specifier without conflating it with a resolved package version. I’d add regression coverage distinguishing django~=4.2 from django==4.2 and update the relevant output snapshots.
Before implementation, is there a preferred JSON representation for this metadata? I’d aim for an additive field rather than changing the meaning of the existing version field, and keep vulnerability-matching behavior outside this PR unless you prefer a broader scope.
Could a maintainer assign this issue to me and confirm the intended scope? I’ll wait for assignment before starting the change.