JacobLinCool / JacobLinCool/sveltekit-api
Optional path parameter like `[[id]]` is not working
- Dominant language
- TypeScript
- Stars
- 56
- Forks
- 6
- PR merge metrics
- No merged PRs in 30d
Description
If an api route like `/api/users/[[id]]` is created, this `[[id]]` string will become `{[id}]` and it does not work in swagger.

sveltekit error
```shell
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.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the +server.ts route entry points and trace how `/api/users/[[id]]` is converted for Swagger/OpenAPI. Compare the generated `{[id}]` path with SvelteKit's optional path parameter syntax; done means the optional route works without a malformed path and is represented correctly in the API documentation.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, typescript
- Domain
- api
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100