Skip to content
Open
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: 2 additions & 0 deletions api.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
14 changes: 12 additions & 2 deletions schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}