jsontypedef/json-typedef-codegen

Binary type support

Closed this issue · 2 comments

Would be great to see binary type support. Pure JSON could utilize base64 for that, but also besides that same definition could be used to play with MessagePack, that supports binary data natively.

I take it you're proposing an addition to JTD itself? If so:

This was indeed discussed within the IETF, and the rough consensus was that you can just use type: string for that, and then parse the underlying base64 afterwords. This also gives you an opportunity to decide which of four base64 formats you want, and to decide how to handle invalid base64.

Because this isn't something JTD can quite do "well", because of spotty support for JSON parsers that natively understand base64 JSON strings, and because of the subtleties of base64 (such as the fact that it has four variants, as mentioned above), JTD ultimately did not include this functionality. I don't think that's likely to change anytime soon.

Want to emphasize, however, that I really appreciate you taking the time to make a proposal. Standards-writing is pretty brutal business, and a lot of potentially useful stuff has to be left on the cutting room floor, because the cost of each additional feature is so high (since everyone has to support it in order to support the spec).