telescope icon indicating copy to clipboard operation
telescope copied to clipboard

managing internal/external API casing

Open pyramation opened this issue 2 years ago • 2 comments

Seems that amino coding is more simple when using original casing, but RPC returns proto/camel casing. It's quite the task to manage two sets of types or numerous sets of types for this, so this issue is an attempt to come up with solutions to manage this all:

https://github.com/sindresorhus/type-fest#change-case

do it ‘backwards’

  1. do keepCase: true
  2. then expose CamelCaseDeep typing on the “Edge” the developer APIs
  3. potentially use fromSDKToCamel or fromSDKtoSnake (make these) to the API
    1. depending on what the dev wants (camel vs snake)

pyramation avatar Sep 24 '22 22:09 pyramation

If there are some cases that diverge (e.g. json_name or gogoproto.jsontag) from casing, we may be able to use the merge type to "fix" them if we use the above solution.

There is a merge type if you need it. If you need to make an exception, maybe you could make an exception and merge them

pyramation avatar Sep 24 '22 22:09 pyramation

https://github.com/scrtlabs/secret.js/commit/92652879ac2975b1a67f8510e01c1a32685b939f

pyramation avatar Dec 31 '22 23:12 pyramation