Skip to content

Commit

Permalink
fix: pass resolved specKey in context
Browse files Browse the repository at this point in the history
  • Loading branch information
FEgor04 committed Jan 8, 2025
1 parent d745b6a commit 386b28d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/zod/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import {
GeneratorMutator,
GeneratorOptions,
GeneratorVerbOptions,
getFileInfo,
getNumberWord,
getRefInfo,
isBoolean,
isObject,
isString,
Expand Down Expand Up @@ -556,8 +558,15 @@ const deference = (
childContext,
);

const { specKey } = getRefInfo(refName ?? '', context);

const resolvedContext: ContextSpecs = {
...childContext,
specKey: specKey ?? childContext.specKey,
};

return Object.entries(resolvedSchema).reduce((acc, [key, value]) => {
acc[key] = deferenceScalar(value, childContext);
acc[key] = deferenceScalar(value, resolvedContext);
return acc;
}, {} as any);
};
Expand Down

0 comments on commit 386b28d

Please sign in to comment.