Next.js Discord

Discord Forum

e2e type safety with case transformations

Unanswered
Transvaal lion posted this in #help-forum
Open in Discord
Transvaal lionOP
looking at e.g., hono/elysia/oRPC/ts-rest, i haven't quite found what i'm looking for yet:
- a standard REST API implemented with nextjs app router, with kebab-cased routes (e.g., POST /api/some-path) and snake_cased request/response payload keys (e.g., { is_foo: true })
- a Swagger/OpenAPI UI automatically generated representing these casings
- a universal client with idiomatic camelCase identifiers e.g., await client.somePath.create({ isFoo: true })

7 Replies

has anyone found an approach that works well towards these goals?
Transvaal lionOP
👍 thanks, def heading in that direction, just seems a bit laborious so wondering if something handles this OOTB and/or if anyone can point to an example repo that demos this outcome
somewhat surprising that afaict a lot of these tools have docs & examples that demo camelCase routes & payload keys
@Transvaal lion 👍 thanks, def heading in that direction, just seems a bit laborious so wondering if something handles this OOTB and/or if anyone can point to an example repo that demos this outcome
American Sable
I uh think TS-Rest has some examples. To help you get started, let me know if this helps in some way.