stellar / xdrgen

A code generator for XDR
Apache License 2.0
22 stars 47 forks source link

Enum member names do not properly preserve pluralization #7

Open nullstyle opened 9 years ago

nullstyle commented 9 years ago

https://github.com/stellar/js-stellar-base/issues/3

thejollyrogers commented 9 years ago

Additionally, the variable offerID in CreateOfferOp gets converted to offerId

thejollyrogers commented 9 years ago

This brings up a question, why are we changing the .x file names at all in the compiled javascript?

nullstyle commented 9 years ago

@thejollyrogers offerID getting normalized to offerId is by design and is expected. Rather than building an mainting a list of acronyms that shouldn't be inflected appropriately for the target language, I treat consecutive capital letters as a separate word. That means that blahID becomes blahId, accountURL becomes accountUrl, etc.

In addition, the transformation of identifier names is designed to map the xdr assigned name to a language-appropriate name. Ruby maps attributes to snake-cased, javascript is camelcased, etc.

I'm willing to accept a PR that turns off identifier normalization, but I don't really need or want it myself.