Skip to content

Named dynamic param names #3

@pi0

Description

@pi0

🆒 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions