Named dynamic param names
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- TypeScript
- Stars
- 126
- Forks
- 7
- Avg merge
- 6h 30m
- Merged PRs (30d)
- 15
Description
🆒 Your use case
Currently, dynamic params seem not named with [DynamicParam] in tree. For tools like h3, it would be helpful to type getRouteParams(event) object for exampele.
🆕 The solution you'd like
Method 1:
interface Schema {
[DynamicParam<"name">]: {
[Endpoint]: {
GET: { response: { type: 'dynamic', method: 'GET' } }
POST: {
body: { id: boolean }
response: { type: 'dynamic', method: 'POST' }
}
}
}
}
Method 2:
interface Schema {
[DynamicParam]: {
paramName: "name",
[Endpoint]: {
GET: { response: { type: 'dynamic', method: 'GET' } }
POST: {
body: { id: boolean }
response: { type: 'dynamic', method: 'POST' }
}
}
}
}
🔍 Alternatives you've considered
No response
ℹ️ Additional info
No response
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing how dynamic parameters are represented in the current TypeScript schema tree, then compare the two proposed DynamicParam shapes. Done means selecting and implementing a way for getRouteParams(event) to expose the dynamic parameter name while preserving the shown endpoint typing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100