···7575 */
7676 get(identifier: ISymbolIdentifier): Symbol | undefined;
7777 /**
7878- * Returns the value associated with a symbol ID.
7979- *
8080- * @param symbolId Symbol ID.
8181- * @return The value associated with the symbol ID, or undefined if not found.
8282- */
8383- getValue(symbolId: number): unknown;
8484- /**
8578 * Returns whether a symbol is registered in the registry.
8679 *
8780 * @param identifier Symbol identifier to check.
···123116 * @returns Array of all registered symbols, in insert order.
124117 */
125118 registered(): IterableIterator<Symbol>;
126126- /**
127127- * Sets a value for a symbol by its ID.
128128- *
129129- * @param symbolId Symbol ID.
130130- * @param value The value to set.
131131- * @returns void
132132- */
133133- setValue(symbolId: number, value: unknown): Map<number, unknown>;
134119}
···5959 resource: 'definition',
6060 resourceId: schema.$ref,
6161 };
6262-6363- let symbol = plugin.getSymbol(query);
6464-6565- if (!symbol) {
6666- // Register a placeholder symbol immediately and set its value to null
6767- // as a stop token to prevent infinite recursion for self-referential
6868- // schemas. We also mark this symbol as "building" so that nested
6969- // references to it can emit calls that will be implemented later.
7070- symbol = plugin.registerSymbol({
7171- meta: query,
7272- name: buildName({
6262+ const symbol =
6363+ plugin.getSymbol(query) ??
6464+ plugin.symbol(
6565+ buildName({
7366 config: {
7467 case: 'camelCase',
7568 name: '{{name}}SchemaResponseTransformer',
7669 },
7770 name: refToName(schema.$ref),
7871 }),
7979- });
8080- plugin.setSymbolValue(symbol, null);
8181- }
7272+ {
7373+ meta: query,
7474+ },
7575+ );
82768377 // Only compute the implementation if the symbol isn't already being built.
8478 // This prevents infinite recursion on self-referential schemas. We still
8579 // allow emitting a call when the symbol is currently being built so
8680 // parent nodes can reference the transformer that will be emitted later.
8787- const existingValue = plugin.gen.symbols.getValue(symbol.id);
8888- if (!existingValue && !buildingSymbols.has(symbol.id)) {
8181+ if (!symbol.node && !buildingSymbols.has(symbol.id)) {
8982 buildingSymbols.add(symbol.id);
9083 try {
9184 const refSchema = plugin.context.resolveIrRef<IR.SchemaObject>(
···113106 // Only emit a call if the symbol has a value (implementation) OR the
114107 // symbol is currently being built (recursive reference) — in the
115108 // latter case we allow emitting a call that will be implemented later.
116116- const currentValue = plugin.gen.symbols.getValue(symbol.id);
117117- if (currentValue || buildingSymbols.has(symbol.id)) {
109109+ if (symbol.node || buildingSymbols.has(symbol.id)) {
118110 const ref = plugin.referenceSymbol(query);
119111 const callExpression = $(ref).call(dataExpression);
120112