Skip to content

Add dynamic param suport for .prefix #914

@unnoq

Description

@unnoq

Describe the feature

Current limitations for generating specs and accessing dynamic parameters:

  1. For generating specs: Instead of requiring dynamic parameters to exist in the .input schema, we can assume they expect a string type when we cannot infer it from the .input schema.

  2. For accessing parameters: We can inject them into the context and access them through a unique symbol:

const router = os.prefix('/{organizationId}').use(({ next, context }) => {
    const organizationId: string | undefined = getDynamicParams(context).organizationId
    return next()
}).router({
    // ...
})

Note: .prefix only affects procedures with defined paths inside .router

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions