This repository was archived by the owner on Apr 14, 2026. It is now read-only.
Commit c7b1de1
Fix duplicate type declarations (#16)
When libopenapi resolves a $ref, it copies extensions from the target
component schema to the resolved proxy. This caused property-level refs
(e.g., pagination: $ref Pagination) to inherit x-go-type from the
target, which made the gatherer treat each ref site as a separate
type-generating schema. Since all child schemas under the same response
got the same operationId-based name, this produced duplicate type
declarations that would not compile.
Fix: skip extension checks and extension copying for reference schemas
in gatherFromSchemaProxy(). Extensions belong to the component schema
descriptor, not to every reference site that points to it.
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>1 parent e826fdb commit c7b1de1
6 files changed
Lines changed: 201 additions & 658 deletions
File tree
- experimental/internal/codegen
- test
- name_conflict_resolution
- output
- previous_version/issues/issue_1957/output
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
362 | 362 | | |
363 | 363 | | |
364 | 364 | | |
365 | | - | |
366 | | - | |
367 | | - | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
368 | 374 | | |
369 | 375 | | |
370 | 376 | | |
| |||
387 | 393 | | |
388 | 394 | | |
389 | 395 | | |
390 | | - | |
391 | | - | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
392 | 401 | | |
393 | 402 | | |
394 | 403 | | |
| |||
0 commit comments