Skip to content

Commit 3b7aee7

Browse files
authored
Merge dfb7eed into 12b1a17
2 parents 12b1a17 + dfb7eed commit 3b7aee7

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

.node-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
15

src/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function nodeType(obj: any): SchemaObjectType | undefined {
3131
}
3232

3333
// enum
34-
if (Array.isArray(obj.enum)) {
34+
if (Array.isArray(obj.enum) && obj.enum.length) {
3535
return "enum";
3636
}
3737

tests/schema.test.ts

+7
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,13 @@ describe("SchemaObject", () => {
211211
"string"?: (('Totoro') | (2) | (false)) | null;
212212
213213
}`);
214+
215+
expect(transform({ properties: { string: { type: "string", enum: [] } }, type: "object" })).toBe(
216+
`{
217+
"string"?: string;
218+
219+
}`
220+
);
214221
});
215222

216223
it("$ref", () => {

0 commit comments

Comments
 (0)