From d9c5f2db0a2679294a1cfe09fdb8d28c9ebc0ee3 Mon Sep 17 00:00:00 2001 From: Kuroda Kayn Date: Sun, 28 Jun 2026 15:21:37 +0800 Subject: [PATCH] docs(router): document custom verb paths Users following Google AIP-style APIs need examples for literal colon suffix routes. Add custom verb examples beside the existing path parameter routing documentation. The docs show both literal segment verbs and param-plus-verb routes. --- docs/doc.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/docs/doc.md b/docs/doc.md index d1c33b87..2fee0b90 100644 --- a/docs/doc.md +++ b/docs/doc.md @@ -171,6 +171,16 @@ func main() { c.String(http.StatusOK, "The available groups are [...]") }) + // Gin also supports literal colon suffixes used by custom verbs, such as Google AIP-136. + router.POST("/users:batchGet", func(c *gin.Context) { + c.String(http.StatusOK, "batch get users") + }) + + router.POST("/customers/:customerID:mutate", func(c *gin.Context) { + customerID := c.Param("customerID") + c.String(http.StatusOK, "mutate customer %s", customerID) + }) + router.Run(":8080") } ```