Randy, That's it. Looking at your example, I'd make only one comment:
I would prefer to emit data-structures that go in both directions -- both fieldid->fieldname, and fieldname->fieldid, to minimize the need for computation at runtime (in your example, the data fieldid->fieldname was present, but not the other way around). For the "nice" protocols, the fieldname->fieldid mapping is what's needed (at read-time), but heck, generating them both would be good, I think. I take your point about YAML. There are a small number of nice human-readable wirelines at this point: YAML, CompactText, JSON. [as an Ocaml geek, S-expressoins]. It would be nice to support all of them "nicely". --chet-- On Mon, Oct 2, 2017 at 5:54 PM, Randy Abernethy <[email protected]> wrote: > > Proposed (cleanest/lowest impact) Fix: > 1. Modify the compiler to emit a schema for every struct in the types files > (struct types include: service method args, structs, exceptions and unions) > 2. Modify TProtocol writeStructBegin() and readStructBegin() to accept a > schema arg > 3. Modify the compiler to pass the appropriate schema to all calls to > TProtocol write/readStructBegin() ** > > Upshot: > 1. Existing protos would simply ignore the schema arg and new protos > (text/JSON/YAML/whatever) [de]serialize field names as desired. > 2. This would be a breaking change, though code could be brought up to date > by recompiling IDL and building (without src changes). > <<<<< > > ** I realize that only the read side needs the schema/ordinal mapping but > something tells me we'll be sorry if we don't maintain the symmetry > > Did I miss anything or get anything wrong? >
