Subject: bug#45615: SWH API break?

From: Ludovic Courtès <[email-masked]>
Date: Mon, 11 Jan 2021 16:16:41 +0100

Hi,

zimoun <[email-masked]> skribis:

> Well, maybe I miss something.  The JSON looks like:
>
> https://archive.softwareheritage.org/api/1/origin/https://github.com/Genivia/ugrep/get/
>
> as we already discussed [1] the other day.  From my understanding, when
> the field does not exist, before guile-json sets to #f and now it sets
> to #<unspecified>; I guess that it is related to the NEWS entry:
>
>   - Record-JSON mapping now allows using *unspecified* values to indicate a
>     field record should not be serialized.
>     (Fixes #61)
>
>
> and the behaviour change is described here:
>
> Unspecified fields will now have the value *unspecified*. You mention
> that json->link-record would assign a #f but that's not actually
> correct, since a field could be a boolean in which case there would not
> be a way to identify it. 
>
> <https://github.com/aconchillo/guile-json/issues/61#issuecomment-703212590>
>
>
> I am not familiar enough with Guile-JSON to see how to fix.  Any tips?

Thanks for investigating!  Looking more closely, I think the issue is
related to this change, but to me it’s a bug: it’s now impossible to set
a field to #f.  Reported at
<https://github.com/aconchillo/guile-json/issues/69>.

Unfortunately, I can’t think of a way to work around it since it’s
pretty fundamental.

At any rate, we should add a test that exercises this in ‘tests/swh.scm’
so we don’t get caught by surprise next time.

Thanks,
Ludo’.