We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dc45265 commit 07e83e4Copy full SHA for 07e83e4
test/parseDef.test.ts
@@ -155,4 +155,14 @@ describe("Basic parsing", () => {
155
expect(parsedSchema).toStrictEqual(expectedJsonSchema);
156
expect(ajv.validateSchema(parsedSchema!)).toEqual(true);
157
});
158
+
159
+ it("should handle a nullable string properly", () => {
160
+ const shorthand = z.string().nullable();
161
+ const union = z.union([z.string(), z.null()]);
162
163
+ const expected = { type: ["string", "null"] };
164
165
+ expect(parseDef(shorthand._def, new References())).toStrictEqual(expected);
166
+ expect(parseDef(union._def, new References())).toStrictEqual(expected);
167
+ });
168
0 commit comments