diff --git a/library/src/helpers/__tests__/schema.test.ts b/library/src/helpers/__tests__/schema.test.ts index ebe27c1b8..3c2ff948a 100644 --- a/library/src/helpers/__tests__/schema.test.ts +++ b/library/src/helpers/__tests__/schema.test.ts @@ -169,6 +169,12 @@ describe('SchemaHelpers', () => { const result = SchemaHelpers.toSchemaType(schema); expect(result).toEqual(`number | string | boolean`); }); + + test('should handle append title to object', () => { + const schema = new Schema({ type: 'object', title: 'SampleType' }); + const result = SchemaHelpers.toSchemaType(schema); + expect(result).toEqual('object [SampleType]'); + }); }); describe('.prettifyValue', () => { diff --git a/library/src/helpers/schema.ts b/library/src/helpers/schema.ts index c84c4e395..f6e9aa6d8 100644 --- a/library/src/helpers/schema.ts +++ b/library/src/helpers/schema.ts @@ -98,6 +98,10 @@ export class SchemaHelpers { if (combinedType) { return combinedType; } + + if (type === 'object' && schema.title()) { + type += ' [' + schema.title() + ']'; + } return type; }