strategyNumericFallback is the last resort: append increasing numbers. Returns true if any name was modified (always true when group has 2+ members).
(group []*ResolvedName)
| 293 | // strategyNumericFallback is the last resort: append increasing numbers. |
| 294 | // Returns true if any name was modified (always true when group has 2+ members). |
| 295 | func strategyNumericFallback(group []*ResolvedName) bool { |
| 296 | // Sort for determinism: pinned first, then component schemas, then by path |
| 297 | sort.Slice(group, func(i, j int) bool { |
| 298 | if group[i].Pinned != group[j].Pinned { |
| 299 | return group[i].Pinned |
| 300 | } |
| 301 | if group[i].Schema.IsComponentSchema() != group[j].Schema.IsComponentSchema() { |
| 302 | return group[i].Schema.IsComponentSchema() |
| 303 | } |
| 304 | return group[i].Schema.Path.String() < group[j].Schema.Path.String() |
| 305 | }) |
| 306 | |
| 307 | // First non-pinned keeps name, rest get numeric suffix |
| 308 | for i := 1; i < len(group); i++ { |
| 309 | if group[i].Pinned { |
| 310 | continue |
| 311 | } |
| 312 | group[i].GoName = group[i].GoName + strconv.Itoa(i+1) |
| 313 | } |
| 314 | return len(group) > 1 |
| 315 | } |
| 316 | |
| 317 | // contentTypeSuffix returns a short suffix for a media type. |
| 318 | func contentTypeSuffix(ct string) string { |
nothing calls this directly
no test coverage detected