fork of hey-api/openapi-ts because I need some additional things
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: symbolOnce now correctly handles multiple symbols from same external source

authored by

copilot-swe-agent[bot] and committed by
Lubos
e3fc1ff9 454202c8

+21 -2
+18
packages/codegen-core/src/__tests__/symbols.test.ts
··· 106 106 const result = r.query(meta({ a: { b: { c: 123 } } })); 107 107 expect(result).toEqual([a]); 108 108 }); 109 + 110 + it('query() returns all symbols sharing the same meta but with different names', () => { 111 + const r = new SymbolRegistry(); 112 + 113 + const sharedMeta = meta({ category: 'external', resource: '@shared/types' }); 114 + 115 + const a = r.register({ meta: sharedMeta, name: 'CustomNumber' }); 116 + const b = r.register({ meta: sharedMeta, name: 'FlakeIdString' }); 117 + 118 + const results = r.query(sharedMeta); 119 + expect(results).toHaveLength(2); 120 + expect(results).toContain(a); 121 + expect(results).toContain(b); 122 + 123 + // filtering by name correctly identifies each symbol independently 124 + expect(results.find((s) => s.name === 'CustomNumber')).toBe(a); 125 + expect(results.find((s) => s.name === 'FlakeIdString')).toBe(b); 126 + }); 109 127 });
+3 -2
packages/shared/src/plugins/shared/utils/instance.ts
··· 399 399 400 400 /** 401 401 * Registers a symbol only if it does not already exist based on the provided 402 - * metadata. This prevents duplicate symbols from being created in the project. 402 + * name and metadata. This prevents duplicate symbols from being created in 403 + * the project. 403 404 */ 404 405 symbolOnce(name: SymbolIn['name'], symbol?: Omit<SymbolIn, 'name'>): Symbol { 405 406 const meta = { ··· 409 410 meta.category = 'external'; 410 411 meta.resource = symbol.external; 411 412 } 412 - const existing = this.querySymbol(meta); 413 + const existing = this.gen.symbols.query(meta).find((s) => s.name === name); 413 414 if (existing) return existing; 414 415 return this.symbol(name, { ...symbol, meta }); 415 416 }