yearn-sdk icon indicating copy to clipboard operation
yearn-sdk copied to clipboard

Serialize JSON keys to camelCase

Open karelianpie opened this issue 2 years ago • 8 comments

Spinoff this PR comment https://github.com/yearn/yearn-sdk/pull/251#discussion_r829682479

In summary, we would like to have this rule enabled "@typescript-eslint/camelcase": "off"

However, in order to achieve that we need to serialize the JSON keys (snake_case) to camelCase

A possible solution is using a library such as https://github.com/typestack/class-transformer, but we could also have a go at implementing something similar ourselves.

karelianpie avatar Mar 21 '22 22:03 karelianpie

Hey @karelianpie , can I be assigned to this ticket please? thanks :)

PsyopTom avatar May 30 '22 00:05 PsyopTom

Hey @karelianpie , can I be assigned to this ticket please? thanks :)

Done 🙇

karelianpie avatar May 30 '22 00:05 karelianpie

Since we dont want to create breaking changes for the current SDK version, we can either:

  • Maintain both casings where it is needed in v2 (like in APY interface), and deprecate snake casing completely for v3.
  • Merge this change until we do release v3.

What approach do you think works best here? @karelianpie

xgambitox avatar May 30 '22 00:05 xgambitox

@xgambitox, how much effort would be to integrate this in our FE?

karelianpie avatar May 30 '22 01:05 karelianpie

@xgambitox, how much effort would be to integrate this in our FE?

On our end, it would be easy IMO (although we have multiple repos that use it, like yearn-watch), but we do have other external integrators that use the SDK, and we should aim not to be a pain for them when upgrading. See https://github.com/yearn/yearn-sdk/issues/242#issuecomment-1063956309 as an example.

xgambitox avatar May 30 '22 01:05 xgambitox

On our end, it would be easy IMO (although we have multiple repos that use it, like yearn-watch), but we do have other external integrators that use the SDK, and we should aim not to be a pain for them when upgrading. See #242 (comment) as an example.

Definitely it would need to be a major release. As this is not high priority, I would suggest we could do this piece of work and then bundle it with changes for v3, seems a bit too much work to support both in parallel and then deprecate the old way once we're ready for v3. What are your thoughts?

karelianpie avatar May 30 '22 01:05 karelianpie

Yeah, agree. How about we create a v3 branch, and start bundling those changes into there? We do want to plan and write issues about other breaking changes we want, such as named parameters, and release them once we are comfortable with all changes.

xgambitox avatar May 30 '22 01:05 xgambitox

How about we create a v3 branch, and start bundling those changes into there?

Good idea, done https://github.com/yearn/yearn-sdk/tree/v3

karelianpie avatar May 30 '22 05:05 karelianpie