hey-api / openapi-ts

🚀 The OpenAPI to TypeScript codegen. Generate clients, SDKs, validators, and more. Support: @mrlubos
https://heyapi.dev
Other
1.39k stars 107 forks source link

Do not camelcase options #104

Closed mrlubos closed 3 months ago

mrlubos commented 8 months ago

Describe the problem

We do not camelcase each key in requestBody, but we camelcase parent keys (e.g. path parameters). This is inconsistent and creates unnecessary complexity. In the end, we cannot avoid working with snake case values.

Describe the proposed solution

Instead of what we have today

MyService.operationFoo({
  requestBody: {
    foo_bar: ''
  },
  bazQux: ''
})

this should become

MyService.operationFoo({
  requestBody: {
    foo_bar: ''
  },
  baz_qux: ''
})

We will need a codemod to migrate existing clients

Alternatives considered

No response

Importance

cannot use project without

Additional information

No response

mrlubos commented 7 months ago

Add as a feature, but add flag supporting current behaviour so people aren't forced to upgrade immediately