feat: add variableNames for UriTemplate

This commit is contained in:
Yechao Li 2025-03-13 15:42:20 +08:00
commit 670d98863d
No known key found for this signature in database
GPG key ID: C23BBF405557E4DA

View file

@ -36,6 +36,10 @@ export class UriTemplate {
| { name: string; operator: string; names: string[]; exploded: boolean }
>;
get variableNames(): string[] {
return this.parts.flatMap((part) => typeof part === 'string' ? [] : part.names);
}
constructor(template: string) {
UriTemplate.validateLength(template, MAX_TEMPLATE_LENGTH, "Template");
this.template = template;