From 0e022567f9bfe1dab92652e99aca656ae8b580f8 Mon Sep 17 00:00:00 2001 From: JIeJaitt <498938874@qq.com> Date: Thu, 27 Mar 2025 15:30:14 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9A=20Doc:=20Update=20custom=20constra?= =?UTF-8?q?ints=20section=20to=20clarify=20overriding=20behavior?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/guide/routing.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/guide/routing.md b/docs/guide/routing.md index 450932cc..0c8dc6b2 100644 --- a/docs/guide/routing.md +++ b/docs/guide/routing.md @@ -250,6 +250,8 @@ app.Get("/:test?", func(c fiber.Ctx) error { Custom constraints can be added to Fiber using the `app.RegisterCustomConstraint` method. Your constraints have to be compatible with the `CustomConstraint` interface. +Attention, custom constraints can now override built-in constraints. If a custom constraint has the same name as a built-in constraint, the custom constraint will be used instead. This allows for more flexibility in defining route parameter constraints. + It is a good idea to add external constraints to your project once you want to add more specific rules to your routes. For example, you can add a constraint to check if a parameter is a valid ULID.