From 07323fda1b82d5798310d7b8911bc4c711e7da78 Mon Sep 17 00:00:00 2001 From: Tyler <48813565+technicallyty@users.noreply.github.com> Date: Tue, 14 Jan 2025 22:58:05 -0800 Subject: [PATCH] godoc --- server/v2/api/grpcgateway/handler.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/v2/api/grpcgateway/handler.go b/server/v2/api/grpcgateway/handler.go index 384e11e3023..d659ae516c3 100644 --- a/server/v2/api/grpcgateway/handler.go +++ b/server/v2/api/grpcgateway/handler.go @@ -67,7 +67,7 @@ func registerMethods[T transaction.Tx](mux *http.ServeMux, am appmanager.AppMana // register in deterministic order. we do this because of the problem mentioned below, and different nodes could // end up with one version of the handler or the other. uris := slices.Sorted(maps.Keys(annotationToMetadata)) - + for _, uri := range uris { queryMD := annotationToMetadata[uri] // we need to wrap this in a panic handler because cosmos SDK proto stubs contains a duplicate annotation @@ -263,6 +263,12 @@ func annotationsToQueryMetadata(annotations map[string]string) (map[string]query return annotationToMetadata, nil } +// extractWildcardKeyNames extracts the wildcard key names from the uri annotation. +// +// example: +// "/hello/{world}" -> []string{"world"} +// "/hello/{world}/and/{friends} -> []string{"world", "friends"} +// "/hello/world" -> []string{} func extractWildcardKeyNames(uri string) []string { matches := wildcardRegex.FindAllStringSubmatch(uri, -1) var extracted []string