multicodec
multicodec copied to clipboard
Add JSON form of table
Closes: #305
Draft for now, just putting it up for initial feedback.
- one entry per line, but still a valid complete JSON file, so it also has
[and]lines. - padded to make the columns line up
-
"description"column is optional and is dropped where blank - added
"intcode"and"varint"(hex bytes) fields - I also added an optional
"ref"column with only the CID ones filled in so far .. I don't think left-padding this column is going to be ideal since"description"can get quite large. An option here is to add a compound object to combine"description"and"ref"and only left-pad the top-level items,"status": "permanent", "notes": { "description": "CIDv1", "ref": [ "https://github.com/multiformats/cid" ] },
What I think should be done to make this complete:
- [ ] Add a script that will compile JSON to CSV, correctly formatted
- [ ] Add a script that will load the CSV and write any updates back into the JSON - which would make for an easier workflow to add new entries where you don't want to have to deal with formatting or adding the
intcodeorvarintentries - [ ] Add a script that will lint both JSON and CSV and make sure they match, which we can also add to CI
- [ ] A Makefile that will run these scripts easily for any contributor and CI
- [ ] Docs to describe how to consume the data and how to contribute new entries
Link to file as you would view it on GitHub: https://github.com/multiformats/multicodec/blob/rvagg/json/table.json
Another alternative is to nest the 3 code values into a nested object: "code": { "hex": "0x78", "int": 120, "varint": "0x78" }. Any nested object doesn't get the padding treatment.
Either layout is fine, I'd KISS and just have non-nested values. This also makes it easier if you e.g. write your own tooling and you want to convert it quickly to CSV.