Skip to content

revisit canonical json and non-integer numbers #413

@carolynvs

Description

@carolynvs

I am confused about the official spec for canonical json and whether or not it supports non-integer numbers. I think this is the spec and they do say that big/high precision numbers should be stored as strings and parsed in the consumer. They do not rule out all non-integer numbers though.

That spec also says that this go implementation is conformant: https://github.com/cyberphone/json-canonicalization/tree/master/go/src/webpki.org/jsoncanonicalizer

We are currently using docker's canonical json library which does not support non-integer numbers. It has a hard check when marshaling a float that it is a whole number.

I have tried the other library and it round trips the value "1.5" (which is what I have users asking for) fine.

When we changed the spec to exclude non-integer numbers that decision was based on a old?bad? copy of the canonical json spec (I was looking at the spec referenced by the docker library http://wiki.laptop.org/go/Canonical_JSON) instead of the one above. I now believe that was a mistake and that we should revert that change and update cnab-go to use a different library.

Tagging @chris-crone and @technosophos to weigh in.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions