Skip to content

v0.6.4

  • v0.6.4
  • 0b4dcab
  • Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
  • Choose a tag to compare

  • v0.6.4
  • 0b4dcab
  • Choose a tag to compare

  • Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
@acidghost acidghost tagged this 27 Jul 10:39
The npm packument spec defines a version's `deprecated` field as a string
carrying the deprecation message, but some packuments emit a boolean
instead (false meaning "not deprecated", true meaning deprecated with no
message). The struct typed it as `string`, so unmarshalling failed with
"cannot unmarshal bool into Go struct field versionInfo.versions.deprecated
of type string" and FetchVersions returned an error for the whole package
(e.g. react, which has 5 versions with `deprecated: false`).

Introduce a `deprecatedField` string type with a custom UnmarshalJSON that
accepts a string, boolean, or null and normalizes them to the string form
the rest of the code relies on. Strings are kept verbatim; `true` maps to
"true" (deprecated); `false` and null map to "" (not deprecated). This
preserves the existing non-empty check that drives StatusDeprecated, so
boolean-false versions stay active while string/true versions stay
deprecated.

Adds TestFetchVersions_DeprecatedShapes covering absent, string-message,
boolean-false, and boolean-true forms.
Assets 2
Loading