w3c / did-core

W3C Decentralized Identifier Specification v1.0
https://www.w3.org/TR/did-core/
Other
404 stars 94 forks source link

Fix collisions in IANA Media Type file extensions. #701

Closed msporny closed 3 years ago

msporny commented 3 years ago

As noted in #684, our IANA Mediat Type filename extensions collide. This has been fixed using the only option available to us (that follows the patterns in other Media Type extensions).

I considered the following patterns:

  1. Keep all of them as .did -- this fails because associated file media type information isn't always preserved on copy and a system falling back to the file extension wouldn't be able to determine the file format based on OS MAGIC numbers (byte headers -- JSON and JSON-LD headers are the same).
  2. Use .did.json, .did.jsonld, and .did.cbor -- looks nice, but there isn't a single example of this pattern in /etc/mime.types and it broke 3 of the 5 media type libraries I tested.
  3. Use .djs, .dld, .dcb -- compatible with every known OS and filesystem going back to the 1990s... but too cryptic, people associate js with JavaScript, not JSON, dld isn't accurate, as there will be CBOR-LD, etc.
  4. Use .didjson, .didjsonld, and .didcbor -- this seemed to be compatible with every modern operating system and file system. It won't work on filesystems that are more than 20 years old.

This PR goes with item 4 above. Marking it as non-substantive since we don't have any normative statements regarding file extensions in the specification.


Preview | Diff

davidlehn commented 3 years ago

Another option is to drop the "did" part and just use existing extensions for the high level serialization encoding: .json, .jsonld, .cbor. There are trade offs of course.

Are there use cases that require special .didXXX extensions?

msporny commented 3 years ago

Are there use cases that require special .didXXX extensions?

"Yes, double-click to open using pre-registered media type handler in operating system." -- requires 1-to-1 mapping in most operating systems.

Note: systems can still choose to store as .cbor / .json / .yaml -- and if those systems store the media type beside the file, they'll continue to use the right application to open the file, even w/ a wonky file suffix. We may not want to suggest that to people, though -- it'll probably confuse more than help.

msporny commented 3 years ago

Non-substantive, multiple reviews, changes suggested (but not made, with explanation given), no objections, merging.