Skip to content

Path parameters ​

@Param() supplies values for RFC 6570 placeholders throughout the URL: protocol, host, path prefix, and path.

Example ​

ts
import { 
Get
,
JinFrame
,
Param
} from 'jin-frame';
@
Get
({
host
: '{protocol}://{tenant}.api.example.com',
pathPrefix
: '/v{version}',
path
: '/users/{id}',
}) class
UserFrame
extends
JinFrame
{
// Expand the protocol and hostname placeholders. @
Param
()
declare readonly
protocol
: 'http' | 'https';
@
Param
()
declare readonly
tenant
: string;
// Expand the shared path prefix. @
Param
()
declare readonly
version
: number;
// Map the local field name to the {id} placeholder. @
Param
({
replaceAt
: 'id' })
declare readonly
userId
: string;
} const
frame
=
UserFrame
.
of
({
protocol
: 'https',
tenant
: 'acme',
version
: 2,
userId
: 'alice',
}); // https://acme.api.example.com/v2/users/alice
console
.
log
(
frame
.
_request
().
url
);

Options ​

OptionTypeDefaultDescription
replaceAtstringField namePlaceholder name when it differs from the field name.
encodebooleantrueApply URI encoding to the value.
commabooleanfalseJoin array elements with commas.
bit.enablebooleanfalseCombine a numeric array using bitwise OR.
bit.withZerobooleanfalseInclude a bitwise result even when it is zero.
formattersFormatter | Formatter[]—Transform values before string serialization.
cacheKeyExcludebooleanfalseExclude from dedupe identity while retaining the value in the URL.

Configure bit as { enable: true, withZero: false }. See formatters for transformations and URL templates for composition and call-level overrides.