Skip to content
This repository was archived by the owner on Apr 14, 2026. It is now read-only.

Fix duplicate type declarations#16

Merged
mromaszewicz merged 1 commit intomainfrom
fix/issue14
Feb 12, 2026
Merged

Fix duplicate type declarations#16
mromaszewicz merged 1 commit intomainfrom
fix/issue14

Conversation

@mromaszewicz
Copy link
Copy Markdown
Member

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.

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>
@mromaszewicz mromaszewicz merged commit c7b1de1 into main Feb 12, 2026
5 checks passed
@mromaszewicz mromaszewicz deleted the fix/issue14 branch February 12, 2026 22:44
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant