Skip to content

Commit 4be4caa

Browse files
authored
fix(msw): nested ref fixes (#1983)
1 parent d566fe4 commit 4be4caa

File tree

1 file changed

+7
-3
lines changed
  • packages/mock/src/faker/resolvers

1 file changed

+7
-3
lines changed

packages/mock/src/faker/resolvers/value.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,12 @@ export const resolveMockValue = ({
163163
specKey: isRootKey(specKey, context.target) ? undefined : specKey,
164164
});
165165
}
166+
166167
return {
167168
...scalar,
168-
type: newSchema.type as string,
169+
type:
170+
(newSchema.type as string | undefined) ??
171+
(newSchema.isRef ? 'object' : undefined),
169172
};
170173
}
171174

@@ -181,9 +184,10 @@ export const resolveMockValue = ({
181184
splitMockImplementations,
182185
allowOverride,
183186
});
184-
185187
return {
186188
...scalar,
187-
type: schema.type as string,
189+
type:
190+
(schema.type as string | undefined) ??
191+
(schema.isRef ? 'object' : undefined),
188192
};
189193
};

0 commit comments

Comments
 (0)