Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion adonis-typings/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ declare module '@ioc:Adonis/Core/Route' {
/**
* Enforce value to be formatted as uuid
*/
uuid(): { match: RegExp }
uuid(): { match: RegExp; cast: (value: string) => string }

/**
* Enforce value to be formatted as slug
Expand Down
7 changes: 5 additions & 2 deletions src/Router/Matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,11 @@ export class RouteMatchers extends Macroable implements RouteMatchersContract {
/**
* Enforce value to be formatted as uuid
*/
public uuid(): { match: RegExp } {
return { match: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/ }
public uuid(): { match: RegExp; cast: (value: string) => string } {
return {
match: /^[0-9a-zA-F]{8}-[0-9a-zA-F]{4}-[0-9a-zA-F]{4}-[0-9a-zA-F]{4}-[0-9a-zA-F]{12}$/,
cast: (value) => value.toLowerCase(),
Comment thread
aikrom marked this conversation as resolved.
}
}

/**
Expand Down