sveltekit-api icon indicating copy to clipboard operation
sveltekit-api copied to clipboard

Optional path parameter like `[[id]]` is not working

Open JinIgarashi opened this issue 9 months ago • 0 comments
trafficstars

If an api route like /api/users/[[id]] is created, this [[id]] string will become {[id}] and it does not work in swagger.

Image

sveltekit error

SvelteKitError: Not found: /api/mapstyle/images/%7B[id%7D]
  • Sveltekit optional path param endpoint https://svelte.dev/docs/kit/advanced-routing#Optional-parameters

Alternatively, I can create two +server.ts for /api/users and /api/users/{id}, but It would be nice if this package can support optional path param.

JinIgarashi avatar Feb 10 '25 11:02 JinIgarashi