strategyContextSuffix attempts to resolve collisions by appending a suffix derived from the schema's context (Schema, Parameter, Response, etc.). Component schemas are "privileged" — if exactly one member is a component schema, it keeps the bare name and only the others get suffixed. Returns true if
(group []*ResolvedName)
| 151 | // schema, it keeps the bare name and only the others get suffixed. |
| 152 | // Returns true if any name was modified, false if no progress was made. |
| 153 | func strategyContextSuffix(group []*ResolvedName) bool { |
| 154 | // Count how many are component schemas (privileged) |
| 155 | var componentSchemaCount int |
| 156 | for _, n := range group { |
| 157 | if n.Schema.IsComponentSchema() { |
| 158 | componentSchemaCount++ |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | progress := false |
| 163 | for _, n := range group { |
| 164 | if n.Pinned { |
| 165 | continue |
| 166 | } |
| 167 | |
| 168 | suffix := n.Schema.Context.Suffix() |
| 169 | if suffix == "" { |
| 170 | continue |
| 171 | } |
| 172 | |
| 173 | // If exactly one is a component schema, it keeps the bare name |
| 174 | if componentSchemaCount == 1 && n.Schema.IsComponentSchema() { |
| 175 | continue |
| 176 | } |
| 177 | |
| 178 | // Don't add suffix if name already ends with it |
| 179 | if strings.HasSuffix(n.GoName, suffix) { |
| 180 | continue |
| 181 | } |
| 182 | |
| 183 | n.GoName = n.GoName + suffix |
| 184 | progress = true |
| 185 | } |
| 186 | return progress |
| 187 | } |
| 188 | |
| 189 | // strategyPerSchemaDisambiguate tries several per-schema disambiguation strategies. |
| 190 | // Returns true if any name was modified, false if no progress was made. |
nothing calls this directly
no test coverage detected
searching dependent graphs…