From 997862f1358c8325b7a8f77fb49a67ad2f7bea53 Mon Sep 17 00:00:00 2001 From: Mohammed Al-Ameen Date: Sat, 14 Mar 2026 04:18:59 -0700 Subject: [PATCH 1/2] Refactor normalization handling in schema.go Refactor normalization logic to store result in a variable before returning. --- schema.go | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/schema.go b/schema.go index 3850b27..3dca0e2 100644 --- a/schema.go +++ b/schema.go @@ -444,8 +444,18 @@ func (api *API) normalizeTypeName(pkgPath, name string) string { break } } + + var normalized string + if omitPackage || pkgPath == "" { - return normalizer.Replace(name) + normalized = normalizer.Replace(name) + } else { + normalized = normalizer.Replace(pkgPath + "/" + name) } - return normalizer.Replace(pkgPath + "/" + name) + + if api.ApplyPostNormalizeTransform != nil { + normalized = api.ApplyPostNormalizeTransform(normalized) + } + + return normalized } From 01c5dd097aff5aa9930cf5afe40cafea46a07a0d Mon Sep 17 00:00:00 2001 From: Mohammed Al-Ameen Date: Sat, 14 Mar 2026 04:19:15 -0700 Subject: [PATCH 2/2] Add ApplyPostNormalizeTransform function signature --- api.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/api.go b/api.go index ae64f1a..4a2978b 100644 --- a/api.go +++ b/api.go @@ -151,6 +151,8 @@ type API struct { // Apply customisation to a specific type by checking the t parameter. // Apply customisations to all types by ignoring the t parameter. ApplyCustomSchemaToType func(t reflect.Type, s *openapi3.Schema) + + ApplyPostNormalizeTransform func(normalized string) string } // Merge route data into the existing configuration.