diff --git a/src/utils.ts b/src/utils.ts index a91fc887..342ae947 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -158,7 +158,7 @@ export function traverse( .forEach(key => { const child = schema[key] if (child && typeof child === 'object') { - traverseObjectKeys(child, callback, processed) + traverse(child, callback, processed) } }) } diff --git a/test/__snapshots__/test/test.ts.md b/test/__snapshots__/test/test.ts.md index f47c43a5..fc0cc131 100644 --- a/test/__snapshots__/test/test.ts.md +++ b/test/__snapshots__/test/test.ts.md @@ -863,6 +863,14 @@ Generated by [AVA](https://avajs.dev). */␊ lastName?: string;␊ description?: string;␊ + myDefinedObject?: MyDefinedSchema;␊ + }␊ + export interface MyDefinedSchema {␊ + /**␊ + * A property named deprecated should be fine␊ + */␊ + deprecated?: boolean;␊ + [k: string]: unknown;␊ }␊ ` diff --git a/test/__snapshots__/test/test.ts.snap b/test/__snapshots__/test/test.ts.snap index 4d85a28f..1e03378c 100644 Binary files a/test/__snapshots__/test/test.ts.snap and b/test/__snapshots__/test/test.ts.snap differ diff --git a/test/e2e/deprecated.ts b/test/e2e/deprecated.ts index 6d8716f4..f94b092a 100644 --- a/test/e2e/deprecated.ts +++ b/test/e2e/deprecated.ts @@ -24,7 +24,23 @@ export const input = { description: { type: 'string', }, + myDefinedObject: { + $ref: '#/$defs/schema/myDefinedSchema', + }, }, additionalProperties: false, required: ['firstName'], + $defs: { + schema: { + myDefinedSchema: { + type: 'object', + properties: { + deprecated: { + type: 'boolean', + description: 'A property named deprecated should be fine', + }, + }, + }, + }, + }, }